Releases: topojson/topojson
1.4.3
1.4.2
1.4.1
- Improved antimeridian stitching for large polygons such as the Earth’s oceans.
1.4.0
- Complete re-write of the topology constructor, improving performance and correctness!
- Support for lossless TopoJSON (non-quantized, non-delta-encoded) using
--no-quantization
. - Lots of new tests.
1.3.0
- Add topojson.presimplify for dynamic client-side simplification.
- In topojson.mesh and topojson.feature, propagate z-dimension if present in input topology.
- Fix winding order for polygons in Cartesian coordinates.
- Include topojson.min.js when installing TopoJSON via NPM.
1.2.3
1.2
- Add
--projection
to create projected TopoJSON using D3’s geographic projections. - Fix
--no-force-clockwise
.
1.1
- Add
--allow-empty
to preserve null or empty geometries. - Add
--width
,--height
and--margin
for scaling projected geometries to fit a viewport. - Add
--bbox
to include bounding box in generated Topology. - Improve performance with large inputs by using a hashtable rather than sparse array.
The topojson
command now uses a hashtable rather than a sparse array to compute the topology. This eliminates most out-of-memory errors and offers dramatically better performance with large inputs, such as zipcode tabulation areas and census blocks.
Use the --allow-empty
command-line flag to retain null or empty features in the generated topology. As before, these features are removed by default.
Use the --width
, --height
and --margin
command-line flags to scale and translate geometry to fit the specified viewport when using Cartesian (projected) coordinates. Best of all, this changes the meaning of the simplification threshold (-s
or --simplify
) to be in pixel coordinates; a value of 0.25 is a good choice for Retina displays. See the projected TopoJSON example.
Use the --bbox
command-line flag to include a bounding box in the generated topology. This follows the same [x0, y0, x1, y1] format as GeoJSON’s bounding box.
1.0
This major release replaces the old topojson.object with topojson.feature for better GeoJSON compatibility.
In previous versions of TopoJSON, topojson.object always returned a geometry object (which may be a geometry collection), consistent with how the geometry object is represented inside the TopoJSON Topology. However, unlike GeoJSON geometries, TopoJSON geometries are more like features, and could have an id and properties; likewise, null geometries were represented as a null type.
As of version 1.0.0, topojson.feature replaces topojson.object, returning a Feature or a FeatureCollection instead, consistent with how the geometry was originally represented in the GeoJSON, prior to conversion to TopoJSON. (As in GeoJSON, null geometries are represented as features with a null geometry object.) As discussed in #37, this offers greater compatibility with the GeoJSON specification and libraries that deal with GeoJSON.
To upgrade your code, you can replace topojson.object with topojson.feature. However, code that assumed that topojson.object returned a geometry must be changed to handle the feature (or feature collection) now returned by topojson.feature. For example, prior to 1.0, if you said:
svg.selectAll("path")
.data(topojson.object(us, us.objects.states).geometries)
.enter().append("path")
.attr("d", path);
In 1.0 and later, the corresponding code is:
svg.selectAll("path")
.data(topojson.feature(us, us.objects.states).features)
.enter().append("path")
.attr("d", path);
Likewise, if you were iterating over an array of point geometries, prior to 1.0, you might have said:
topojson.object(us, us.objects.airports).geometries.forEach(function(p) {
console.log("x, y", p.coordinates[0], p.coordinates[1]);
});
In 1.0 and later, the corresponding code is:
topojson.feature(us, us.objects.airports).features.forEach(function(p) {
console.log("x, y", p.geometry.coordinates[0], p.geometry.coordinates[1]);
});