-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reverse an arc #14
Comments
Does it has to do with polygons containing holes? I remember reading something like "if the main polygon is clockwise the hole must be conter-clockwise" or something like that but can't remember where. |
(No, it’s not related to holes.) TopoJSON allows you to reference a reversed arc in a geometry so that when geometries share an arc, but some geometries need the arc in the opposite direction, the geometries can reference the same arc. This occurs very commonly when you have neighboring geometries. For example, California and Nevada share a border, but given that both would typically have the same winding order, the shared border must be reversed between the two polygons if you want to share the arc. You could avoid reversing arcs if you don’t care about sharing arcs between neighboring polygons, but that would largely defeat the benefit of a topological geometry format. A reversed arc means that rather than the arc’s points going p_0, p_1, … p_n, the points go p_n, p_{n-1}, … p_0. |
@mbostock |
Nice! Yes, it looks like you need to reverse the subsequences of points represented by the negative arc indexes. |
@mbostock https://github.com/pedro-vicente/render_geojson I did this graphical interface just to debug this issue. The 2 green arrows in the toolbar allow to navigate polygons and points inside each polygon (at the moment only polygons are rendered) the example in the image is czech-republic-regions.topojson. It includes the examples from the topojson page too. |
@mbostock |
and here the us.json file (US counties), rendering by the Wt web toolkit (with a made Leaflet branch) |
The spec says
what does it mean a "reversed arc"? how do you reverse an arc?
The text was updated successfully, but these errors were encountered: