Skip to content
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

Fix winding order for GeoJSON polygons before rendering #2089

Closed
mcwhittemore opened this issue Feb 8, 2016 · 4 comments · Fixed by #2285
Closed

Fix winding order for GeoJSON polygons before rendering #2089

mcwhittemore opened this issue Feb 8, 2016 · 4 comments · Fixed by #2285
Labels

Comments

@mcwhittemore
Copy link
Contributor

In mapbox-gl-draw we're seeing a problem where holes are rendered in polygons when we don't expect them to be. At first I thought that this was due to poor winding order management in gl-draw (which is true) but after talking to @sgillies about this a bit today I'm pretty sure mapbox-gl-js is implementing geojson holes incorrectly.

In the above image each new polygon is a its own feature. According to the spec holes happen when a second linear ring is provided to the array of linear ring coordinate arrays.

I'm guessing I can fix this in gl-draw by following the a linear ring SHOULD follow right-hand rule command, but still this should be fixed so end users don't get caught up in trying to check if their linear rights follow the right hand rule.

@jfirebaugh
Copy link
Contributor

@mcwhittemore Can you post the GeoJSON that produces the depicted rendering?

cc @mourner

@averas
Copy link
Contributor

averas commented Feb 9, 2016

I've noticed this too. Interestingly, it does not happen with the earcut-final branch if that could give any pointers..

@mcwhittemore
Copy link
Contributor Author

@tmcw tmcw added the bug 🐞 label Feb 22, 2016
@ansis
Copy link
Contributor

ansis commented Mar 17, 2016

We need to enforce winding order for geojson polygons internally. https://github.com/mapbox/geojson-rewind does this

@lucaswoj lucaswoj changed the title GeoJSON Holes at unexpected times Fix winding order for GeoJSON polygons before rendering Mar 17, 2016
@lucaswoj lucaswoj added the ready label Mar 17, 2016
ansis added a commit that referenced this issue Mar 17, 2016
ansis added a commit that referenced this issue Mar 18, 2016
ansis added a commit that referenced this issue Mar 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants