Create empty geometries

geos_empty(type_id = "geometrycollection", crs = wk::wk_crs_inherit())

as_geos_type_id(type_id)

# S3 method for default
as_geos_type_id(type_id)

# S3 method for character
as_geos_type_id(type_id)

# S3 method for numeric
as_geos_type_id(type_id)

Arguments

type_id

The numeric type identifier for which an empty should be returned, an object from which one can be extracted using as_geos_type_id() (default to calling geos_type_id()). This is most usefully a character vector with the geometry type (e.g., point, linestring, polygon).

crs

An object that can be interpreted as a CRS. See wk::wk_crs().

Examples

geos_empty(c("point", "linestring", "polygon"))
#> <geos_geometry[3] with CRS=wk_crs_inherit()>
#> [1] <POINT EMPTY>      <LINESTRING EMPTY> <POLYGON EMPTY>   
geos_empty(1:7)
#> <geos_geometry[7] with CRS=wk_crs_inherit()>
#> [1] <POINT EMPTY>              <LINESTRING EMPTY>        
#> [3] <POLYGON EMPTY>            <MULTIPOINT EMPTY>        
#> [5] <MULTILINESTRING EMPTY>    <MULTIPOLYGON EMPTY>      
#> [7] <GEOMETRYCOLLECTION EMPTY>
geos_empty(geos_read_wkt(c("POINT (0 1)", "LINESTRING (0 0, 1 1)")))
#> <geos_geometry[2] with CRS=wk_crs_inherit()>
#> [1] <POINT EMPTY>      <LINESTRING EMPTY>