vl.topojson(…values)
Define a data source for topojson format data.
The behavior of this method depends on the argument type:
Array, sets the values property.Iterable, sets the values property.Object, sets the values property.String, sets the url property.topojson Method Overviewtopojson API Reference# topojson.feature(value)
The name of the TopoJSON object set to convert to a GeoJSON feature collection. For example, in a map of the world, there may be an object set named "countries". Using the feature property, we can extract this set and generate a GeoJSON feature object for each country.
# topojson.mesh(value)
The name of the TopoJSON object set to convert to mesh. Similar to the feature option, mesh extracts a named TopoJSON object set. Unlike the feature option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features. Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties.
# topojson.name(name)
A name for this data source. Use this name to update the data via the runtime API.
# topojson.parse(value)
If set to null, disable type inference based on the spec and only use type inference based on the data. Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of "number", "boolean", "date", or null (do not parse the field)). For example, "parse": {"modified_on": "date"} parses the modified_on field in each input record a Date value.
For "date", we parse data based using JavaScript’s Date.parse(). For Specific date formats can be provided (e.g., {foo: "date:'%m%d%Y'"}), using the d3-time-format syntax. UTC date format parsing is supported similarly (e.g., {foo: "utc:'%m%d%Y'"}). See more about UTC time
# topojson.type(value)
Type of input data: "json", "csv", "tsv", "dsv".
Default value: The default format type is determined by the extension of the file URL. If no extension is detected, "json" will be used by default.
# topojson.url(url)
A URL from which to load the data.
# topojson.values(values)
Provide loaded data values directly.
The behavior of this method depends on the argument type:
values property.