Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHard session/process shutdown when reading empty geojson #58
Comments
|
thanks for reporting - this is definitely a bug. I'll take a look. as per the specification - para 3.3
So it's valid, and needs to be handled TODO geo <- '{"type":"FeatureCollection","features":[]}'
geojsonsf::geojson_sf( geo )
sf::st_read( geo )
Give section 3.2 of the geojson specification
Then I say these cases are not permitted '{"type":"FeatureCollection","features":[{"type":"Feature"}]}'
'{"type":"Feature"}'and they also fail geojsonlite.com tests too |
|
@sheffe I've got this working in the dev version if you want to start using & testing devtools::install_github("SymbolixAU/geojsonsf") |
|
@SymbolixAU thank you very much! Looks like you had it tested and verified faster than I could revisit, but can confirm that all of the crashing cases I saw in live action are now working well. |
|
thanks for testing & reporting back. |
Love this package, thanks for putting it out there!
I'm working through a process using
osmiumthat clips OSM data by a polygon boundary and converts the subsetted data to geojson. Sometimes, if there's no data within that boundary, an empty GeoJSON is written. It looks like you've solved some null objects elsewhere, as in #36, but this particular example still breaks for me.Here's the reprex:
(If it's useful to know this, the
empty_geojsonexample is the exact text content of the file created byosmium. It seems to be valid geojson to me, andsfcan read it, but I'm not completely sure of that belief.)and here's my
devtools::session_info()