Closed SymbolixAU closed 6 years ago
js <- '{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","coordinates":[[[[0,0],[0,1],[1,1],[1,0],[0,0,0,0]]]]},{"type":"Point","coordinates":[0,0]}]}'
sf <- geojson_sfc( js )
Given
sf
gives a useful error when trying to plotsf
# Geometry set for 1 feature
# geometry type: GEOMETRY
# dimension: XY
# bbox: xmin: 0 ymin: 0 xmax: 1 ymax: 1
# epsg (SRID): 4326
# proj4string: +proj=longlat +datum=WGS84 +no_defs
# GEOMETRYCOLLECTION (MULTIPOLYGON ZM (((0 0 0 0,...
sf::st_as_text( sf )
# [1] "GEOMETRYCOLLECTION (MULTIPOLYGON ZM (((0 0 0 0, 0 1 0 0, 1 1 0 0, 1 0 0 0, 0 0 0 0))), POINT (0 0))"
plot( sf )
# Error in CPL_geos_is_empty(st_geometry(x)) :
# GEOS does not support XYM or XYZM geometries; use st_zm() to drop M
I'm going to keep this behaviour.
i.e, the POLYGON has XYZ and the POINT has XY.
This is valid GeoJSON.
Should the GEOMETRYCOLLECTION also inherit a Z dimension?
_Originally posted by @SymbolixAU in https://github.com/SymbolixAU/geojsonsf/issue_comments#issuecomment-429577091_