-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support for NULL/empty geoJSON points. #91
Comments
yes that should be do-able. As an interim solution you can use library(sf)
sf <- sf::st_read(
'{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": null, "geometry": {"type":"Point","coordinates":[]} },
{ "type": "Feature", "properties": null, "geometry": {"type":"Point","coordinates":[1.0, 1.0]} }
]}'
)
sf
# Simple feature collection with 2 features and 0 fields (with 1 geometry empty)
# Geometry type: POINT
# Dimension: XY
# Bounding box: xmin: 1 ymin: 1 xmax: 1 ymax: 1
# Geodetic CRS: WGS 84
# geometry
# 1 POINT EMPTY
# 2 POINT (1 1) |
On branch library(sf)
library(geojsonsf)
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":[]} }
]}'
geojsonsf::geojson_sf(geojson)
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":[]}}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The RFC allows for empty geoJSON objects link:
Currently the following fails:
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":[]} } ]}'
The text was updated successfully, but these errors were encountered: