topojson / topojson-client

Manipulate TopoJSON, such as to merge shapes, and convert it back to GeoJSON.
ISC License
213 stars 63 forks source link

Quantization shouldn’t use [0,0] for the last point of empty arcs. #12

Open mbostock opened 7 years ago

mbostock commented 7 years ago

If an arc collapses down to a single point during quantization, we add a [0,0] at the end to ensure that each arc has at least two points, per the specification. The problem with this is that it implicitly drops any additional dimensions (beyond x and y) of the coincident points.

So, it’d be better to add the last point p instead of making a new point [0,0], so that any additional dimensions in the last point p are preserved. This assumes that the input arc has at least two points, but that should be a reasonable assumption given the specification.