Skip to content
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

empty geometries #23

Closed
edzer opened this issue Sep 30, 2016 · 2 comments
Closed

empty geometries #23

edzer opened this issue Sep 30, 2016 · 2 comments

Comments

@edzer
Copy link
Member

edzer commented Sep 30, 2016

GDAL seems to return empty geoms as GEOMETRYCOLLECTION with zero elements:

> st_difference(st_sfc(st_point(0:1),st_point(c(0,0))), st_sfc(st_point(0:1)))
Geometry set for 2 features 
geometry type:  GEOMETRYCOLLECTION
dimension:      XY
bbox:           xmin: 0 ymin: 0 xmax: 0 ymax: 0
epsg (SRID):    NA
proj4string:    NA
precision:      double (default; no precision model)
GEOMETRYCOLLECTION() 
GEOMETRYCOLLECTION(POINT(0 0)) 

The current logic of sfr is then to convert everything back to GEOMETRYCOLLECTION, only because the empty one is. Having empty points doesn't seem a good solution, as they don't have a WKB representation. Maybe tweak sfc such that they have a constant type (in this case POINT), but may contain empty geometries of type GEOMETRYCOLLECTION?

@edzer
Copy link
Member Author

edzer commented Oct 6, 2016

Is an empty point semantically different from an empty polygon?

@edzer
Copy link
Member Author

edzer commented Oct 15, 2016

see tests/empty.R, all geometries now allow empty, also from/to WKB (except for POINT, but this seems an omission in the standard; GPKG uses silent NA values for empty POINT geoms); also added sfc_GEOMETRY type to mix anything.

@edzer edzer closed this as completed Oct 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant