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

Convex Hull implementation? #150

Closed
spiry34 opened this issue Dec 7, 2021 · 2 comments
Closed

Convex Hull implementation? #150

spiry34 opened this issue Dec 7, 2021 · 2 comments

Comments

@spiry34
Copy link
Contributor

spiry34 commented Dec 7, 2021

Dear maintainers,
I need some convex hull functionalities in order to improve the "mapi" package at a worldwide scale.
I noticed a s2convex_hull_query exists in s2 library but I can't find out exports to R.
I tried to understand how to link these functions but I'm somewhat ill at ease (euphemism!) with the implementation of the links between R and s2.
Do you plan to add this functionality in r-s2?
Otherwise I will try to, but I don't really know where to start... :-/
Many thanks for "un-flattening" the earth with this package, anyway :-)
Sylvain Piry

@paleolimbot
Copy link
Collaborator

You're right! It exists in s2 and we should export to R. I'm happy to do this for the next release; however, if you want to give it a shot, you could try:

  • Adding the R function s2_convex_hull() to R/s2-transformers.R
  • Adding the C++ function cpp_s2_convex_hull() to src/s2-transformers.cpp. It's the most similar to cpp_s2_rebuild() ( https://github.com/r-spatial/s2/blob/main/src/s2-transformers.cpp#L476-L501 ), except instead of calling the rebuild function you'll use the geog->ShapeIndex() to pass it to the convex hull query.

Cheers!

@spiry34
Copy link
Contributor Author

spiry34 commented Dec 7, 2021

OK, I give a try! Your hints are a candle in the dark :-)
Thanks!
S.

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