-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
The RFC allows for empty geoJSON objects link:
RFC 7946
3.1. Geometry Object
o A GeoJSON Geometry object of any type other than "GeometryCollection" has a member with the name "coordinates". The value of the "coordinates" member is an array. The structure of the elements in this array is determined by the type of geometry. GeoJSON processors MAY interpret Geometry objects with empty "coordinates" arrays as null objects.
Currently the following fails:
> geojson_sf('{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": null, "geometry": {"type":"Point","coordinates":[]} }
]}')
Error in rcpp_geojson_to_sf(geojson, expand_geometries) :
Invalid lon/lat object
Is this something that can be fixed?
TODO:
-
geojson_sf('{ "type": "Feature", "properties": null, "geometry": {"type":"Point","coordinates":[]} }')
-
geojson_sf('{ "type": "Feature", "properties": null, "geometry": {"type":"MultiPoint","coordinates":[]}}')
-
geojson_sf('{ "type": "Feature", "properties": null, "geometry": {"type":"LineString","coordinates":[]}}')
-
geojson_sf('{ "type": "Feature", "properties": null, "geometry": {"type":"MultiLineString","coordinates":[]}}')
-
geojson_sf('{ "type": "Feature", "properties": null, "geometry": {"type":"Polygon","coordinates":[]}}')
-
geojson_sf('{ "type": "Feature", "properties": null, "geometry": {"type":"MultiPolygon","coordinates":[]}}')
-
geojson_sf('{ "type": "Feature", "properties": null, "geometry": {"type": "GeometryCollection", "geometries":[{"type":"Point","coordinates":[]},{"type":"LineString","coordinates":[]}]}}')
-
geojson <- '{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": null, "geometry": {"type":"Point","coordinates":[]} }, { "type": "Feature", "properties": null, "geometry": {"type":"MultiPoint","coordinates":[]} }, { "type": "Feature", "properties": null, "geometry": {"type":"LineString","coordinates":[]} }, { "type": "Feature", "properties": null, "geometry": {"type":"MultiLineString","coordinates":[]} }, { "type": "Feature", "properties": null, "geometry": {"type":"Polygon","coordinates":[]} }, { "type": "Feature", "properties": null, "geometry": {"type":"MultiPolygon","coordinates":[]} } ]}'
- round trip
geo <- '{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": null, "geometry": {"type":"Point","coordinates":[]} },
{ "type": "Feature", "properties": null, "geometry": {"type":"MultiPoint","coordinates":[]} },
{ "type": "Feature", "properties": null, "geometry": {"type":"LineString","coordinates":[]} },
{ "type": "Feature", "properties": null, "geometry": {"type":"MultiLineString","coordinates":[]} },
{ "type": "Feature", "properties": null, "geometry": {"type":"Polygon","coordinates":[]} },
{ "type": "Feature", "properties": null, "geometry": {"type":"MultiPolygon","coordinates":[]} },
{ "type": "Feature", "properties": null, "geometry": {"type": "GeometryCollection", "geometries":[{"type":"Point","coordinates":[]},{"type":"LineString","coordinates":[]}]}}
]}'
sf <- geojsonsf::geojson_sf(geo)
geo <- geojsonsf::sf_geojson(sf)
Metadata
Metadata
Assignees
Labels
No labels