The geovctrs package works with spatial reference identifiers instead of actual CRS objects so that the heavy lifting can be implemented in other packages. However, most geometry formats can store an integer spatial reference identifier (SRID) with each feature to propagate this information through calculations.

geo_srid(x)

# S3 method for default
geo_srid(x)

geo_set_srid(x, srid)

# S3 method for default
geo_set_srid(x, srid)

as_geo_srid(x)

Arguments

x

A geometry-like object, or one that can be coerced to a geometry-like object using as_geovctr().

srid

A spatial reference identifier, coerced to an integer by as_geo_srid(). These identifiers can and should be managed outside of geovctrs except for 0, which is interpreted as "not set".

Value

An integer vector (one SRID per feature).

Examples

# two points with an SRID geometries <- wkt( c( "SRID=26920;POINT (259473 4876249)", "SRID=4326;POINT (-66 44)" ) ) geo_srid(geometries)
#> [1] 26920 4326
geo_srid(geo_set_srid(geometries, NA))
#> [1] NA NA
# SRIDs are propogated through conversions, # or discarded with a warning geo_srid(as_wkb(geometries))
#> [1] 26920 4326
geo_srid(as_geo_xy(geometries))
#> [1] 0 0