Skip to content

d3.geo.path doesn't handle zero-area polygons correctly #2025

@stvno

Description

@stvno

d3.geo.path sometimes renders polygons where all points are in a straight line (so no inside) as an "infinite" area with a line shaped "hole". The polygons are created by TileStache from a postgis database and served as topojson. The polygons start out as valid RHR geometries and are turned into lines due to the shift from floating point space to integer space; see the drawing below.
example

If the order of the last three points in the topojson is changed the feature is drawn correctly. I've setup a page showing the difference here: http://research.geodan.nl/sites/vectortiling/test/faultytile.html

Is there a correct clockwise order for points on a line? If so it might be that TileStache is wrong here serving the points in the wrong order, but following the above drawing the points are in a valid order. I would think that if a polygon has an area of 0, the order of points doesn't matter and D3 shouldn't try to create an infinite area with a zero area hole in it.

Metadata

Metadata

Assignees

Labels

bugSomething isn’t working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions