Tests if the given geometry is empty

gIsEmpty(spgeom, byid = FALSE)

Arguments

spgeom

sp object as defined in package sp

byid

Logical determining if the function should be applied across subgeometries (TRUE) or the entire object (FALSE)

Details

Because no sp Spatial object may be empty, the function exists but cannot work, as readWKT is not permitted to create an empty object.

Value

Returns TRUE if the given geometry is empty, FALSE otherwise.

Author

Roger Bivand & Colin Rundel

Examples

try(gIsEmpty(readWKT("POINT EMPTY")))
#> Error : Unable to parse: POINT EMPTY
#> GEOS reported: "rgeos_geospoint2SpatialPoints: empty point found"
gIsEmpty(readWKT("POINT(1 1)"))
#> [1] FALSE
try(gIsEmpty(readWKT("LINESTRING EMPTY")))
#> Error : Unable to parse: LINESTRING EMPTY
#> GEOS reported: "rgeos_geosline2SpatialLines: empty line found"
gIsEmpty(readWKT("LINESTRING(0 0,1 1)"))
#> [1] FALSE
try(gIsEmpty(readWKT("POLYGON EMPTY")))
#> Error : Unable to parse: POLYGON EMPTY
#> GEOS reported: "rgeos_geospolygon2Polygons: empty Polygons object"
gIsEmpty(readWKT("POLYGON((0 0,1 0,1 1,0 1,0 0))"))
#> [1] FALSE