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

Infer MultiPolygon structure from winding order for toGeoJSON #32

Closed
mourner opened this issue Oct 9, 2015 · 3 comments
Closed

Infer MultiPolygon structure from winding order for toGeoJSON #32

mourner opened this issue Oct 9, 2015 · 3 comments
Assignees
Labels

Comments

@mourner
Copy link
Member

mourner commented Oct 9, 2015

MultiPolygons are flattened in VT, so we need to infer their structure from winding order like this https://github.com/mapbox/mapbox-gl-js/blob/earcut-final/js/util/classify_rings.js, otherwise MultiPolygons are broken (encoded as Polygons, with additional outer rings becoming holes). cc @jfirebaugh

@mourner mourner added the bug label Oct 9, 2015
@jfirebaugh
Copy link
Contributor

How about changing loadGeometry() instead? We could have it do classification if type == 3, and return geometry with one more level of array nesting. This would require a major version change for vector-tile-js, but would allow us to remove classify_rings.js from gl-js, rather than duplicating it in both modules.

Then toGeoJSON could inherit the classification behavior, and check the number of polygons to determine whether to use "type": "Polygon" or "type": "MultiPolygon".

@mourner
Copy link
Member Author

mourner commented Oct 9, 2015

@jfirebaugh sounds good to me!

@jfirebaugh
Copy link
Contributor

#33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants