-
Notifications
You must be signed in to change notification settings - Fork 7
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
Calculate centroid? #175
Comments
I've never looked into it! I am guessing that the algorithm for multipolygon is not trivial and is best left to geos, sf, or s2. |
Okay, thanks |
it might be pretty trivial, depending on what kind of centroid you want, there's weighted, circle, box, inner, and any number of possible variants for coalescing from multiple rings to a point, or just choosing something - and even given what you might care about with respect to the coordinate system in use what kind of centroid do you want? does it have to intersect the polygon? I'm interested to expand this out and have been thinking about it for a long time, there's some odd advice out there that "this centroid is not correct" but doesn't actually define any aspects of what correct might be. From my GIS days you would choose weighted (just average the coords), box (find the centre of the bounding box), circle (centre of minimum enclosing circle), or inner (something like a centre that's actually intersecting). Then there's the geographic reality, but it's not just an issue for longlat, every projection has questionable properties for what "centroid" might mean. :) There's that mapbox project that finds the most "inaccessible point" (it's super cool), and there's endless things you can do with a triangulated version of polygon to classify something meaningful. (With {geos} all these things would be easy enough to explore I think). I will eventually, but maybe you just want a simple thing? |
You've got me really interested now, we've got access to everything we need with {geos}, I think: |
Thanks for popping in @mdsumner I ended up using |
Is there a way to calculate a centroid of a wkt polygon/multipolygon with
wk
? I don't see anything, but may have missed it. I realize there's methods in other R pkgs, but I'd prefer to avoid heavy dependencies like themThe text was updated successfully, but these errors were encountered: