crs | R Documentation |
Add or get CRS
crs_add(x, crs)
crs_get(x)
x |
An object of class |
crs |
(character) a CRS string. required. |
According to RFC 7946
(https://datatracker.ietf.org/doc/html/rfc7946#page-12) the CRS for all GeoJSON
objects must be WGS-84, equivalent to urn:ogc:def:crs:OGC::CRS84
.
And lat/long must be in decimal degrees.
Given the above, but considering that GeoJSON blobs exist that have CRS attributes in them, we provide CRS helpers here. But moving forward these are not likely to be used much.
https://github.com/OSGeo/PROJ, https://geojson.org/geojson-spec.html#coordinate-reference-system-objects
x <- '{ "type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
]
}'
# add crs
crs <- '{"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}}'
x %>% feature() %>% crs_add(crs)
# get crs
z <- x %>% feature() %>% crs_add(crs)
crs_get(z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.