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

Improve handling of geometries with multiple polygons. #25

Open
NoaMillsUSDA-ARS opened this issue Jan 2, 2024 · 0 comments
Open

Improve handling of geometries with multiple polygons. #25

NoaMillsUSDA-ARS opened this issue Jan 2, 2024 · 0 comments

Comments

@NoaMillsUSDA-ARS
Copy link
Collaborator

There are two ways in which a user may successfully upload polygon geometries with the upload_geometry() function, even though those geometries cannot be used by gcdl to create polygon subsets because they contain multiple polygons.

First, when a user calls upload_geometry() on a file, rgeocdl does not perform any checks on the file contents to ensure that there is only one polygon before uploading the geometry and returning a single guid. If the file contains multiple geometries, then the user will receive an error when they call download_polygon_subset().

Second, when a user calls upload_geometry() on an sf or sfc object that contains multiple polygons, rgeocdl compares the area of the union of the polygons and the area of the convex hull. If the area of the polygons covers over 80% of the area of the convex hull, then rgeocdl uploads the union of the polygons. Otherwise, rgeocdl uploads each polygon individually and returns a guid for each polygon. This means that it is possible for a user to call upload_geometry() an sf or sfc object that contains polygons that are separate but close enough to pass the convex hull check. Then, upload_geometry() will return a single guid for a geometry with multiple polygons, and gcdl will return errors when the user uses that guid to call download_polygon_subset().

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

1 participant