s2 | R Documentation |
functions for spherical geometry, using the s2 package based on the google s2geometry.io library
sf_use_s2(use_s2)
st_as_s2(x, ...)
## S3 method for class 'sf'
st_as_s2(x, ...)
## S3 method for class 'sfc'
st_as_s2(
x,
...,
oriented = getOption("s2_oriented", FALSE) || isTRUE(attr(x, "oriented")),
rebuild = FALSE
)
use_s2 |
logical; if |
x |
object of class |
... |
passed on |
oriented |
logical; if |
rebuild |
logical; call s2_rebuild on the geometry (think of this as a |
st_as_s2
converts an sf
POLYGON object into a form readable by s2
.
sf_use_s2
returns the value of this variable before (re)setting it,
invisibly if use_s2
is not missing.
m = rbind(c(-1,-1), c(1,-1), c(1,1), c(-1,1), c(-1,-1))
m1 = rbind(c(-1,-1), c(1,-1), c(1,1), c(-1,1), c(-1,0), c(-1,-1))
m0 = m[5:1,]
mp = st_multipolygon(list(
list(m, 0.8 * m0, 0.01 * m1 + 0.9),
list(0.7* m, 0.6*m0),
list(0.5 * m0),
list(m+2),
list(m+4,(.9*m0)+4)
))
sf = st_sfc(mp, mp, crs = 'EPSG:4326')
s2 = st_as_s2(sf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.