geo_srid: Extract a spatial reference identifier

Description Usage Arguments Value Examples

View source: R/geo-srid.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
geo_srid(x)

## Default S3 method:
geo_srid(x)

geo_set_srid(x, srid)

## Default S3 method:
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# two points with an SRID
geometries <- wkt(
  c(
    "SRID=26920;POINT (259473 4876249)",
    "SRID=4326;POINT (-66 44)"
  )
)

geo_srid(geometries)
geo_srid(geo_set_srid(geometries, NA))

# SRIDs are propogated through conversions,
# or discarded with a warning
geo_srid(as_wkb(geometries))
geo_srid(as_geo_xy(geometries))

paleolimbot/geovctrs documentation built on July 30, 2020, 3:41 p.m.