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

Support for MultiPolygons #34

Closed
redbmk opened this issue Dec 23, 2017 · 1 comment
Closed

Support for MultiPolygons #34

redbmk opened this issue Dec 23, 2017 · 1 comment

Comments

@redbmk
Copy link

redbmk commented Dec 23, 2017

I'm not sure if this is related to #25 or not, but I couldn't get a working solution from that issue.

From what I can tell this will always return [NaN, NaN] for a MultiPolygon. I have a few disconnected polygons, and for each one I can do polylabel(feature.geometry.coordinates) to get a point for each. However, if I want the pole of inaccessibility for all the features combined, the following both just give me [NaN, NaN]:

polylabel(turf.union(features).geometry.coordinates)
polylabel(features.map(feature => feature.geometry.coordinates))

Is this the intended behavior? Currently when I run into this situation I use polylabel for each one, then figure out which one is closest to the centroid of the unioned MultiPolygon. Maybe other option would be to get the pole of inaccessibility of the largest Polygon.

@mourner
Copy link
Member

mourner commented Jan 10, 2018

Yeah, Polylabel was designed to only handle individual polygons. For multipolygons, I think a good approach would be to implement #2 first, and then you'd just pick the point with the biggest distance.

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

No branches or pull requests

2 participants