gbif / portal-feedback

User feedback for the GBIF API, website and published data. You can ask questions here. 🗨❓
30 stars 16 forks source link

Hole in the earth downloads #5225

Closed jhnwllr closed 7 months ago

jhnwllr commented 7 months ago

I was wondering if hole-in-the-earth downloads were still possible by specifying two boxes.

These types of polygons appear to be accepted on the front end UI. https://www.gbif.org/occurrence/map?has_coordinate=true&has_geospatial_issue=false&geometry=POLYGON((35%2010,45%2045,15%2040,10%2020,35%2010),(20%2030,35%2035,30%2020,20%2030))&occurrence_status=present

image

Making a fairly big outer box also appears to work...

image

https://www.gbif.org/occurrence/map?has_coordinate=true&has_geospatial_issue=false&taxon_key=1427007&geometry=POLYGON((-90%20-45,90%20-45,90%2045,-90%2045,-90%20-45),(-5%20-5,-5%205,5%205,5%20-5,-5%20-5))&occurrence_status=present downloads also work for this polygon https://www.gbif.org/occurrence/download/0026095-240229165702484

But making a "entire earth outer box" seems to fail. POLYGON ((-180 -90,180 -90,180 90, -180 90,-180 -90),(-5 -5,-5 5,5 5,5 -5,-5 -5))

https://www.gbif.org/occurrence/map?has_coordinate=true&has_geospatial_issue=false&geometry=POLYGON((-180%20-90,180%20-90,180%2090,-180%2090,-180%20-90),(-5%20-5,-5%205,5%205,5%20-5,-5%20-5))&occurrence_status=present

image

Also downloads through the API reject this whole earth attempt.

Error: Invalid shape in WKT: POLYGON((-180 -90,180 -90,180 90, -180 90,-180 -90),(-5 -5,-5 5,5 5,5 -5,-5 -5)) The inner ring doesn't appear to be within the exterior: LINEARRING (180 -90, 180 -90, 180 90, 180 90, 180 -90) inner: LINEARRING (715 -5, 715 5, 725 5, 725 -5, 715 -5) Execution halted

MattBlissett commented 7 months ago

It's probably necessary to interpolate the long lines slightly, e.g. every 90°, as otherwise polygons can be interpreted as going over the dateline.

MortenHofft commented 7 months ago

Is this a real use case @jhnwllr ? If it is just for a download, then perhaps a not predicate is easier?

jhnwllr commented 7 months ago

@MortenHofft This is just an anticipated question from users. We got an email from helpdesk from people who were using the clockwise polygons intentionally.

jhnwllr commented 7 months ago

@MattBlissett thanks interpolation does appear to work! https://www.gbif.org/occurrence/map?has_coordinate=true&has_geospatial_issue=false&geometry=POLYGON((-180%20-90,-90%20-90,0%20-90,90%20-90,180%20-90,180%2090,90%2090,0%2090,-90%2090,-180%2090,-180%20-90),(-5%20-5,-5%205,5%205,5%20-5,-5%20-5))&occurrence_status=present