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

Internal Server Error (HTTP 500) #31

Open
nposdalj opened this issue Mar 25, 2021 · 1 comment
Open

Internal Server Error (HTTP 500) #31

nposdalj opened this issue Mar 25, 2021 · 1 comment

Comments

@nposdalj
Copy link
Collaborator

One MPA in Cuba is still giving an internal server error.

To recreate this error:

  1. Run lines 1-99 in the script 'CalculatingES50.R'
  2. Make i = 88 (instead of running through all the MPAs)
  3. Run lines 103-105
    hull = st_convex_hull(ES50_df$geom[[i]]) #find the convex hull for the polygon
    text = st_as_text(hull) #convert it to text
    SpeciesOccurence = occurrence(geometry = text) #query OBIS for species within that polygon
@btupper
Copy link
Collaborator

btupper commented Mar 25, 2021

As Abby/Pieter suggested there is a topology issue with that polygon (it's sort of NW Cuba). I tried simplifying then computing the hull. Nope. Then I trie computing the hull and then simplifying that. Nope. Then I tried simplify -> hull -> simplify. Nope. You can see in the attached that the hull is not the actual hull - close but no cigar.
wdpa88_cuba

So instead of investing in making this one to make it work, I just wrapped the call to robis::occurence() in a try(). Then I test what comes back. If it is an error then we force your SpeciesOccurence variable to have the NULL value. The logic of your if blocks takes care of the rest so it otherwise keeps humming.

SpeciesOccurence = try(occurrence(geometry = text)) #query OBIS for species within that polygon

I haven't tested it, but it should work right out of the box for you.

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