-
Notifications
You must be signed in to change notification settings - Fork 117
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
Polygon winding order & holes vs outer rings #59
Comments
OK, so Artem says we pass winding order as is, so there's no easy way to derive ring status... Could you consider winding order correction for a future release? It's pretty easy, and given that geometries are flattened, it would be extremely useful. Usual accepted order is CCW for outer rings, CW for rings. |
Note that closing #53 will also close this issue, since polygon clipping procedure also resets winding order. Although fixing just the latter is much easier. |
Wouldn't the spec need to change for rings to have a defined winding order, or are you suggesting giving an order that wasn't there in the tile when parsing one? |
@pnorman yes, I'm suggesting changing the winding order of polygon rings depending on whether it's a hole or an outer ring. I don't see any problems with this since the original winding order is pretty much random and has no practical use. |
👍 for having a specified winding order. |
I don't see an issue with it either, but I'm just questioning if it's a mapnik-vector-tile issue or an issue that the specification doesn't require a winding order. |
The fix for this would be to update both the specification (to require a winding order), and mapnik-vector-tile (to output spec-compliant windings). |
Another thing to note is that Mapnik VT output doesn't have |
Another approach is to just split MultiPolygons into several Polygon features. This is how Mapzen solved the issue: tilezen/mapbox-vector-tile#4 |
@mourner yep, not an ideal solution, it would be nice to have multi-geometries directly supported in the spec. |
Update here: my plan is to have mapnik-vector-tile ensure:
So, here are some examples then of how you would decode:
As part of this push we need to ensure these winding order expectations are consistently maintained at a variety of steps. To that end I'll update the below set of check boxes as things progress:
|
This ticket is now resolved thanks to the work of many. Going to close with a short recap:
https://www.mapbox.com/blog/vector-tile-spec-changes/ is a good resource to learn more about what changed. /cc @rouault |
Do geometry rings have a defined winding order in vector tiles? E.g. counter-clockwise for outer rings and clockwise for rings? Or should I expect any order of any particular ring?
Winding order isn't mentioned anywhere in spec, but some polygon algorithms depend on a certain winding order. Also, some algorithms (especially triangulation) need to know if a polygon ring is a hole or an outer ring, which could also be derived from winding order if geometry is flattened.
The text was updated successfully, but these errors were encountered: