Closed JonasGeschke closed 4 years ago
Are you @jeffreyhanson around at the sri2020.org conference? Would be great meeting you.
Hmm - that's strange. Could you please post a reproducible example showing this? Are you using as(x, "sf")
to convert the sp
class objects to sf
class objects before using wdpa_clean
?
No, I'm not attending that conference unfortunately - it looks pretty interesting! Yeah - it would be great to catch up. I'm based in Palmerston North in New Zealand - I don't suppose you're travelling to New Zealand while you're in the region?
Well no I didnt convert the WDPA from sp
to sf
, I read the WDPA with wdpar
:
wdpa <- wdpa_read("~/WDPA_Feb2020-shapefile.zip") wdpa <- wdpa[-which(wdpa$MARINE == "2"),] wdpa <- wdpa[-which(wdpa$ISO3 == "ABNJ"),] wdpa_som <- wdpa[which(wdpa$ISO3 == "SOM"),] wdpa_som <- wdpa_clean(wdpa_som)
(sorry it is in German, but the error remains the same)
update: I now tried to clean SOM with the development version of wdpar
– it worked. so in case you dont want to follow up on the origin of the error, you may close the issue.
its your go to close it in case you are good to go ;-)
Great - glad to hear it's working. I'll close this issue now then. In the future, if you feel that you've solved an issue that you've opened, please feel free to close it yourself :)
Strange... with a changed precision, the error comes up again. Would be great if you could have a look at it.
Error in st_cast_sfc_default(x) : list item(s) not of class sfg
So this class error still is the bottleneck in my progress...
Per #22, could you please post a complete reproducible example showing the issue you're experiencing?
Hi – sorry for not replying yet. You can find the reproducible example above. However, it does not pop up always, I have no clue why. Did you change anything in the development version that could have lead to fixing the class error?
Congrats to your paper, very nice reading!
In regard of my work on the WPDA, using wdpar
: I am in still in progress cleaning and unioning all countries individually and plan to union them together afterwards.
During the computing, the class error came up again – using the development version of the package. Would be great if you find some time working on this error.
Thanks! It looks like the issue with Somalia is that all the protected areas are points and they have a REP_AREA of zero - meaning that there are no "spatially valid non-empty" geometries for this country. I'll add in a patch to return an empty result (i.e. sf object with zero rows) for such cases.
Ok - I've just pushed a new version to GitHub that works for Somalia. Thanks for the reminder!
After trying around with the
sp
package for quite a bit, I will now try to flatten the WDPA withwdpar
. The first error I came across, however, is as follows:It came in the WDPA subset for "SOM" (Somalia). Would be great if you can have a look at it. Thanks and best regards, Jonas