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)
x | A geometry-like object, or one that can be
coerced to a geometry-like object using |
---|---|
srid | A spatial reference identifier, coerced to
an integer by |
An integer vector (one SRID per feature).
# two points with an SRID geometries <- wkt( c( "SRID=26920;POINT (259473 4876249)", "SRID=4326;POINT (-66 44)" ) ) geo_srid(geometries)#> [1] 26920 4326geo_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#> [1] 0 0