-
Notifications
You must be signed in to change notification settings - Fork 50
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
problem with pred_within() - results outside polygon in the download #704
Comments
Retried manually doing the same thing from the website, with the same results. Issue might be with the database or the API, is there another place for me to bring this issue? I haven't found anywhere else. |
Hi, The polygon is clockwise, which our download system interprets as a hole, i.e. the whole world except that bit of Portugal. It should work in R or through the website if you reverse the direction of the polygon, maybe with I think it's a bug that the search APIs (used by the website) show data within the rectangle for this query. We have seen this problem several times, especially with R users (e.g. gbif/portal-feedback#2222). Although a clockwise 'hole' polygon is technically valid, we should probably reject them to avoid the confusion. If a user actually wants this, they could provide 4 rectangles, or the world minus the hole, or a suitable lat-long greaterthan/lessthan expression. https://github.com/gbif/portal-feedback/issues is the best place for general issues with the GBIF website or API, or the "Feedback" link from the top right of the website. |
#672 |
Thank you both for looking into this. Honest mistake, certainly others have run into it. The behavior does make sense, it just never crossed my mind that this might be the problem. I was using For future reference, I fixed it with: The fix requires loading raster and sf, as a SpatialPolyetc is a needed step between SpatVector and sfc. Thank you for sharing the issue page for the portal :) will use that in the future if needed. |
This is now fixed server side. |
Hi there, I'm downloading a dataset for a small region in Portugal, and the resulting download is 29 million records strong. Although that'd be great for what I need, once the data was loaded into R the very first record fell within
countryCode
"US", which caught my attention.It appears the call is ignoring the pred_within argument, while only complying with the other preds. Is this possible? See from the API call below that the within pred is being sent, but it is still giving me over 29M records all over the world.
Here's my call:
where
region_poly_str
is equal to "POLYGON ((-8.249386 38.163071, -7.70912 38.163071, -7.70912 37.666805, -8.249386 37.666805, -8.249386 38.163071))", which upon examination in a WKT viewer is just fine - valid, closed polygon and all. I've used an object to store the WKT just yesterday and passed it into thepred_within()
before and it worked, so I figured that's not the issue. Rerunning the same call with the pasted text does not change the result.and this is the resulting API call I got from the download page in the website:
Am I doing something wrong? The same piece of code worked fine just yesterday, and it was with a super complex MULTIPOLYGON.
Output of
devtools::session_info()
:Output of
sessionInfo()
:Thanks a bunch for developing and mantaining this, you're all heroes :)
The text was updated successfully, but these errors were encountered: