diff --git a/dev/articles/index.html b/dev/articles/index.html index dafd627d..539a6313 100644 --- a/dev/articles/index.html +++ b/dev/articles/index.html @@ -50,7 +50,7 @@

All vignettes

diff --git a/dev/articles/intro.html b/dev/articles/intro.html index 8174b3f6..0fe78a80 100644 --- a/dev/articles/intro.html +++ b/dev/articles/intro.html @@ -80,7 +80,7 @@

Introduction to s2

diff --git a/dev/authors.html b/dev/authors.html index e37b2284..8c1e7263 100644 --- a/dev/authors.html +++ b/dev/authors.html @@ -86,7 +86,7 @@

Citation

diff --git a/dev/index.html b/dev/index.html index 6eff042c..2eb963bd 100644 --- a/dev/index.html +++ b/dev/index.html @@ -241,7 +241,7 @@

Dev status

diff --git a/dev/news/index.html b/dev/news/index.html index 2bcfd196..56be40e6 100644 --- a/dev/news/index.html +++ b/dev/news/index.html @@ -39,10 +39,6 @@

Changelog

s2 (development version)

-
-

s2 1.1.7

CRAN release: 2024-07-17

-

s2 1.1.6

CRAN release: 2023-12-19

@@ -151,7 +147,7 @@

s2 1.0.0 -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/pkgdown.js b/dev/pkgdown.js index 9757bf9e..1a99c65f 100644 --- a/dev/pkgdown.js +++ b/dev/pkgdown.js @@ -152,3 +152,11 @@ async function searchFuse(query, callback) { }); }); })(window.jQuery || window.$) + +document.addEventListener('keydown', function(event) { + // Check if the pressed key is '/' + if (event.key === '/') { + event.preventDefault(); // Prevent any default action associated with the '/' key + document.getElementById('search-input').focus(); // Set focus to the search input + } +}); diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index faa5de95..75319095 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -1,9 +1,9 @@ pandoc: 3.1.11 -pkgdown: 2.1.0 +pkgdown: 2.1.1 pkgdown_sha: ~ articles: articles/intro: intro.html -last_built: 2024-07-17T21:14Z +last_built: 2024-09-25T18:50Z urls: reference: https://r-spatial.github.io/s2/reference article: https://r-spatial.github.io/s2/articles diff --git a/dev/reference/as_s2_geography.html b/dev/reference/as_s2_geography.html index 5eb67ecb..5d1a1600 100644 --- a/dev/reference/as_s2_geography.html +++ b/dev/reference/as_s2_geography.html @@ -136,7 +136,7 @@

See also diff --git a/dev/reference/index.html b/dev/reference/index.html index b59f15a4..8de415fe 100644 --- a/dev/reference/index.html +++ b/dev/reference/index.html @@ -275,7 +275,7 @@

Low-level Details -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2-package.html b/dev/reference/s2-package.html index 204b4bd6..aded150d 100644 --- a/dev/reference/s2-package.html +++ b/dev/reference/s2-package.html @@ -68,7 +68,7 @@

Author< diff --git a/dev/reference/s2_boundary.html b/dev/reference/s2_boundary.html index e989144a..8d957620 100644 --- a/dev/reference/s2_boundary.html +++ b/dev/reference/s2_boundary.html @@ -282,7 +282,7 @@

Examples s2_options(snap = s2_snap_level(30)) ) #> <geodesic s2_geography[1] with CRS=OGC:CRS84> -#> [1] POLYGON ((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... +#> [1] MULTIPOLYGON (((3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 9.99999999, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08... # snap to grid rounds coordinates to a specified grid size s2_snap_to_grid("POINT (0.333333333333 0.666666666666)", 1e-2) @@ -301,7 +301,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_bounds_cap.html b/dev/reference/s2_bounds_cap.html index 23dcbf95..9552923e 100644 --- a/dev/reference/s2_bounds_cap.html +++ b/dev/reference/s2_bounds_cap.html @@ -110,7 +110,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_cell.html b/dev/reference/s2_cell.html index 5bf3c0c4..1eeb1f73 100644 --- a/dev/reference/s2_cell.html +++ b/dev/reference/s2_cell.html @@ -145,7 +145,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_cell_is_valid.html b/dev/reference/s2_cell_is_valid.html index 814c7915..c4b17ec7 100644 --- a/dev/reference/s2_cell_is_valid.html +++ b/dev/reference/s2_cell_is_valid.html @@ -120,7 +120,7 @@

Arguments -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_cell_union.html b/dev/reference/s2_cell_union.html index a061e24e..4d79c01b 100644 --- a/dev/reference/s2_cell_union.html +++ b/dev/reference/s2_cell_union.html @@ -86,7 +86,7 @@

Value

diff --git a/dev/reference/s2_cell_union_normalize.html b/dev/reference/s2_cell_union_normalize.html index f2ac59d0..7ccbe4e9 100644 --- a/dev/reference/s2_cell_union_normalize.html +++ b/dev/reference/s2_cell_union_normalize.html @@ -121,7 +121,7 @@

Arguments -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_closest_feature.html b/dev/reference/s2_closest_feature.html index ad913254..1d40a76b 100644 --- a/dev/reference/s2_closest_feature.html +++ b/dev/reference/s2_closest_feature.html @@ -209,7 +209,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_contains.html b/dev/reference/s2_contains.html index 582cc308..4d2b947e 100644 --- a/dev/reference/s2_contains.html +++ b/dev/reference/s2_contains.html @@ -234,7 +234,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_data_example_wkt.html b/dev/reference/s2_data_example_wkt.html index 7e75761e..f37c77b9 100644 --- a/dev/reference/s2_data_example_wkt.html +++ b/dev/reference/s2_data_example_wkt.html @@ -63,7 +63,7 @@

Format< diff --git a/dev/reference/s2_data_tbl_countries.html b/dev/reference/s2_data_tbl_countries.html index 3d372e2e..a6d0eab0 100644 --- a/dev/reference/s2_data_tbl_countries.html +++ b/dev/reference/s2_data_tbl_countries.html @@ -174,7 +174,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_earth_radius_meters.html b/dev/reference/s2_earth_radius_meters.html index bece672f..f344197d 100644 --- a/dev/reference/s2_earth_radius_meters.html +++ b/dev/reference/s2_earth_radius_meters.html @@ -82,7 +82,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_geog_point.html b/dev/reference/s2_geog_point.html index 6ca3ab23..d2231d74 100644 --- a/dev/reference/s2_geog_point.html +++ b/dev/reference/s2_geog_point.html @@ -259,7 +259,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_interpolate.html b/dev/reference/s2_interpolate.html index 40b484b9..d2169b90 100644 --- a/dev/reference/s2_interpolate.html +++ b/dev/reference/s2_interpolate.html @@ -116,7 +116,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_is_collection.html b/dev/reference/s2_is_collection.html index 0d806c9a..6da32408 100644 --- a/dev/reference/s2_is_collection.html +++ b/dev/reference/s2_is_collection.html @@ -164,7 +164,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_lnglat.html b/dev/reference/s2_lnglat.html index df16449d..b261aaf1 100644 --- a/dev/reference/s2_lnglat.html +++ b/dev/reference/s2_lnglat.html @@ -104,7 +104,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_options.html b/dev/reference/s2_options.html index 67a9cfea..d90f5b2f 100644 --- a/dev/reference/s2_options.html +++ b/dev/reference/s2_options.html @@ -234,7 +234,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_plot-1.png b/dev/reference/s2_plot-1.png index 46217cad..19fb4587 100644 Binary files a/dev/reference/s2_plot-1.png and b/dev/reference/s2_plot-1.png differ diff --git a/dev/reference/s2_plot.html b/dev/reference/s2_plot.html index 25605d8a..70cd742f 100644 --- a/dev/reference/s2_plot.html +++ b/dev/reference/s2_plot.html @@ -120,7 +120,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/s2_point.html b/dev/reference/s2_point.html index 61c80736..9061bcdb 100644 --- a/dev/reference/s2_point.html +++ b/dev/reference/s2_point.html @@ -103,7 +103,7 @@

Examples -

Site built with pkgdown 2.1.0.

+

Site built with pkgdown 2.1.1.

diff --git a/dev/reference/wk_handle.s2_geography.html b/dev/reference/wk_handle.s2_geography.html index b0861a17..a715e91b 100644 --- a/dev/reference/wk_handle.s2_geography.html +++ b/dev/reference/wk_handle.s2_geography.html @@ -146,7 +146,7 @@

Value

diff --git a/dev/search.json b/dev/search.json index 9617a7a7..fed9c073 100644 --- a/dev/search.json +++ b/dev/search.json @@ -1 +1 @@ -[{"path":"https://r-spatial.github.io/s2/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Dewey Dunnington. Author. Edzer Pebesma. Author, maintainer. Ege Rubak. Author. Jeroen Ooms. Contributor. configure script Google, Inc.. Copyright holder. Original s2geometry.io source code","code":""},{"path":"https://r-spatial.github.io/s2/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Dunnington D, Pebesma E, Rubak E (2024). s2: Spherical Geometry Operators Using S2 Geometry Library. R package version 1.1.7.9000, https://github.com/r-spatial/s2, http://s2geometry.io/, https://r-spatial.github.io/s2/.","code":"@Manual{, title = {s2: Spherical Geometry Operators Using the S2 Geometry Library}, author = {Dewey Dunnington and Edzer Pebesma and Ege Rubak}, year = {2024}, note = {R package version 1.1.7.9000, https://github.com/r-spatial/s2, http://s2geometry.io/}, url = {https://r-spatial.github.io/s2/}, }"},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"s2","dir":"","previous_headings":"","what":"Spherical Geometry Operators Using the S2 Geometry Library","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"s2 R package provides bindings Google’s S2Geometry library. package exposes API similar Google’s BigQuery Geography API, whose functions also operate spherical geometries. Package sf uses package default nearly geometrical operations objects ellipsoidal (unprojected) coordinates; cases doesn’t, st_relate(), emits warning. package complete rewrite earlier CRAN package s2 versions 0.4-2, sources found .","code":""},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"can install released version s2 CRAN : development version GitHub :","code":"install.packages(\"s2\") # install.packages(\"remotes\") remotes::install_github(\"r-spatial/s2\")"},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"s2 package provides geometry transformers predicates similar found GEOS, except instead assuming planar geometry, s2’s functions work latitude longitude assume spherical geometry: sf package uses s2 geographic coordinates sf::sf_use_s2(TRUE), become default sf version 1.0.0. sf package also supports creating s2 vectors using as_s2_geography(): Use accessors extract information geometries: Use predicates subset vectors: Use transformers create new geometries: Finally, use WKB WKT exporters export sf package:","code":"library(s2) s2_contains( # polygon containing much of the northern hemisphere \"POLYGON ((-63.5 44.6, -149.75 61.20, 116.4 40.2, 13.5 52.51, -63.5 44.6))\", # ...should contain the north pole \"POINT (0 90)\" ) #> [1] TRUE library(dplyr) library(sf) nc_s2 <- read_sf(system.file(\"shape/nc.shp\", package = \"sf\")) %>% mutate(geometry = as_s2_geography(geometry)) %>% as_tibble() %>% select(NAME, geometry) nc_s2 #> # A tibble: 100 × 2 #> NAME geometry #> #> 1 Ashe POLYGON ((-81.4528885 36.2395859, -81.4310379 36.2607193, -81.41… #> 2 Alleghany POLYGON ((-81.1766739 36.4154434, -81.1533661 36.4247398, -81.13… #> 3 Surry POLYGON ((-80.4530106 36.2570877, -80.4353104 36.5510445, -80.61… #> 4 Currituck MULTIPOLYGON (((-75.9419327 36.2943382, -75.9575119 36.2594528, … #> 5 Northampton POLYGON ((-77.1419601 36.4170647, -77.1393204 36.4564781, -77.12… #> 6 Hertford POLYGON ((-76.7074966 36.2661324, -76.7413483 36.3151665, -76.92… #> 7 Camden POLYGON ((-76.0173492 36.3377304, -76.0328751 36.3359756, -76.04… #> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.4522858, -76.4983… #> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 36.2135086, -78.05… #> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 36.5471344, -80.43… #> # … with 90 more rows nc_s2 %>% mutate( area = s2_area(geometry), perimeter = s2_perimeter(geometry) ) #> # A tibble: 100 × 4 #> NAME geometry area perimeter #> #> 1 Ashe POLYGON ((-81.4528885 36.2395859, -81.4310379 3… 1.14e9 141627. #> 2 Alleghany POLYGON ((-81.1766739 36.4154434, -81.1533661 3… 6.11e8 119876. #> 3 Surry POLYGON ((-80.4530106 36.2570877, -80.4353104 3… 1.42e9 160458. #> 4 Currituck MULTIPOLYGON (((-75.9419327 36.2943382, -75.957… 6.94e8 301644. #> 5 Northampton POLYGON ((-77.1419601 36.4170647, -77.1393204 3… 1.52e9 211794. #> 6 Hertford POLYGON ((-76.7074966 36.2661324, -76.7413483 3… 9.68e8 160780. #> 7 Camden POLYGON ((-76.0173492 36.3377304, -76.0328751 3… 6.16e8 150430. #> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.… 9.03e8 123170. #> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 3… 1.18e9 141073. #> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 3… 1.23e9 140583. #> # … with 90 more rows nc_s2 %>% filter(s2_contains(geometry, \"POINT (-80.9313 35.6196)\")) #> # A tibble: 1 × 2 #> NAME geometry #> #> 1 Catawba POLYGON ((-80.9312744 35.6195908, -81.0035782 35.6970558, -81.0547791… nc_s2 %>% mutate(geometry = s2_boundary(geometry)) #> # A tibble: 100 × 2 #> NAME geometry #> #> 1 Ashe LINESTRING (-81.4528885 36.2395859, -81.4310379 36.2607193, -81.… #> 2 Alleghany LINESTRING (-81.1766739 36.4154434, -81.1533661 36.4247398, -81.… #> 3 Surry LINESTRING (-80.4530106 36.2570877, -80.4353104 36.5510445, -80.… #> 4 Currituck MULTILINESTRING ((-75.9419327 36.2943382, -75.9575119 36.2594528… #> 5 Northampton LINESTRING (-77.1419601 36.4170647, -77.1393204 36.4564781, -77.… #> 6 Hertford LINESTRING (-76.7074966 36.2661324, -76.7413483 36.3151665, -76.… #> 7 Camden LINESTRING (-76.0173492 36.3377304, -76.0328751 36.3359756, -76.… #> 8 Gates LINESTRING (-76.46035 36.3738976, -76.5024643 36.4522858, -76.49… #> 9 Warren LINESTRING (-78.1347198 36.2365837, -78.1096268 36.2135086, -78.… #> 10 Stokes LINESTRING (-80.0240555 36.5450249, -80.0480957 36.5471344, -80.… #> # … with 90 more rows nc_s2 %>% mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>% st_as_sf() #> Simple feature collection with 100 features and 1 field #> Geometry type: GEOMETRY #> Dimension: XY #> Bounding box: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965 #> CRS: NA #> # A tibble: 100 × 2 #> NAME geometry #> #> 1 Ashe POLYGON ((-81.45289 36.23959, -81.43104 36.26072, -81.41233 36.2… #> 2 Alleghany POLYGON ((-81.17667 36.41544, -81.15337 36.42474, -81.1384 36.41… #> 3 Surry POLYGON ((-80.45301 36.25709, -80.43531 36.55104, -80.61105 36.5… #> 4 Currituck MULTIPOLYGON (((-75.94193 36.29434, -75.95751 36.25945, -75.9137… #> 5 Northampton POLYGON ((-77.14196 36.41706, -77.13932 36.45648, -77.12733 36.4… #> 6 Hertford POLYGON ((-76.7075 36.26613, -76.74135 36.31517, -76.92408 36.39… #> 7 Camden POLYGON ((-76.01735 36.33773, -76.03288 36.33598, -76.04395 36.3… #> 8 Gates POLYGON ((-76.46035 36.3739, -76.50246 36.45229, -76.49834 36.50… #> 9 Warren POLYGON ((-78.13472 36.23658, -78.10963 36.21351, -78.05835 36.2… #> 10 Stokes POLYGON ((-80.02406 36.54502, -80.0481 36.54713, -80.43531 36.55… #> # … with 90 more rows"},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"acknowledgment","dir":"","previous_headings":"","what":"Acknowledgment","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"project gratefully acknowledges financial support ","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an S2 Geography Vector — as_s2_geography","title":"Create an S2 Geography Vector — as_s2_geography","text":"Geography vectors arrays points, lines, polygons, /collections . Geography vectors assume coordinates longitude latitude perfect sphere.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an S2 Geography Vector — as_s2_geography","text":"","code":"as_s2_geography(x, ...) s2_geography() # S3 method for class 's2_geography' as_s2_geography(x, ...) # S3 method for class 'wk_xy' as_s2_geography(x, ...) # S3 method for class 'wk_wkb' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'WKB' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'blob' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'wk_wkt' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'character' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'logical' as_s2_geography(x, ...) # S3 method for class 's2_geography' as_wkb(x, ...) # S3 method for class 's2_geography' as_wkt(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an S2 Geography Vector — as_s2_geography","text":"x object can converted s2_geography vector ... Unused oriented TRUE polygon ring directions known correct (.e., exterior rings defined counter clockwise interior rings defined clockwise). check Use check = FALSE skip error invalid geometries","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an S2 Geography Vector — as_s2_geography","text":"object class s2_geography","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an S2 Geography Vector — as_s2_geography","text":"coercion function as_s2_geography() used wrap input functions s2 package can use objects unambiguious interpretation geography vector. Geography vectors minimal vctrs implementation, can use objects tibble, dplyr, packages use vctrs framework.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2-package.html","id":null,"dir":"Reference","previous_headings":"","what":"s2: Spherical Geometry Operators Using the S2 Geometry Library — s2-package","title":"s2: Spherical Geometry Operators Using the S2 Geometry Library — s2-package","text":"Provides R bindings Google's s2 library geometric calculations sphere. High-performance constructors exporters provide high compatibility existing spatial packages, transformers construct new geometries existing geometries, predicates provide means select geometries based spatial relationships, accessors extract information geometries.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"s2: Spherical Geometry Operators Using the S2 Geometry Library — s2-package","text":"Maintainer: Edzer Pebesma edzer.pebesma@uni-muenster.de (ORCID) Authors: Dewey Dunnington dewey@fishandwhistle.net (ORCID) Ege Rubak rubak@math.aau.dk contributors: Jeroen Ooms jeroen.ooms@stat.ucla.edu (configure script) [contributor] Google, Inc. (Original s2geometry.io source code) [copyright holder]","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 Geography Transformations — s2_boundary","title":"S2 Geography Transformations — s2_boundary","text":"functions operate one geography vectors return geography vector.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 Geography Transformations — s2_boundary","text":"","code":"s2_boundary(x) s2_centroid(x) s2_closest_point(x, y) s2_minimum_clearance_line_between(x, y) s2_difference(x, y, options = s2_options()) s2_sym_difference(x, y, options = s2_options()) s2_intersection(x, y, options = s2_options()) s2_union(x, y = NULL, options = s2_options()) s2_snap_to_grid(x, grid_size) s2_simplify(x, tolerance, radius = s2_earth_radius_meters()) s2_rebuild(x, options = s2_options()) s2_buffer_cells( x, distance, max_cells = 1000, min_level = -1, radius = s2_earth_radius_meters() ) s2_convex_hull(x) s2_centroid_agg(x, na.rm = FALSE) s2_coverage_union_agg(x, options = s2_options(), na.rm = FALSE) s2_rebuild_agg(x, options = s2_options(), na.rm = FALSE) s2_union_agg(x, options = s2_options(), na.rm = FALSE) s2_convex_hull_agg(x, na.rm = FALSE) s2_point_on_surface(x, na.rm = FALSE)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 Geography Transformations — s2_boundary","text":"x, y geography vectors. inputs passed as_s2_geography(), can pass objects (e.g., character vectors well-known text) directly. options s2_options() object describing polygon/polyline model use snap level. grid_size grid size coordinates snapped; rounded nearest power 10. tolerance minimum distance vertexes use simplifying geography. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters(). distance distance buffer, units radius. max_cells maximum number cells approximate buffer. min_level minimum cell level used approximate buffer (1 - 30). Setting value high result unnecessarily large geographies, may help improve buffers along long, narrow regions. na.rm aggregate calculations use na.rm = TRUE drop missing values.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"model","dir":"Reference","previous_headings":"","what":"Model","title":"S2 Geography Transformations — s2_boundary","text":"geometry model indicates whether geometry includes boundaries. Boundaries line geometries end points. OPEN geometries contain boundary (model = \"open\"); CLOSED geometries (model = \"closed\") contain boundary; SEMI-OPEN geometries (model = \"semi-open\") contain half boundaries, two polygons overlap two lines cross, point exist belong one geometries. (latter form, half-closed, present OpenGIS \"simple feature access\" (SFA) standard DE9-IM based). default values s2_contains() (open) covers/covered_by (closed) correspond SFA standard specification operators.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"S2 Geography Transformations — s2_boundary","text":"","code":"# returns the boundary: # empty for point, endpoints of a linestring, # perimeter of a polygon s2_boundary(\"POINT (-64 45)\") #> #> [1] GEOMETRYCOLLECTION EMPTY s2_boundary(\"LINESTRING (0 0, 10 0)\") #> #> [1] MULTIPOINT ((0 0), (10 0)) s2_boundary(\"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\") #> #> [1] LINESTRING (0 0, 10 0, 10 10, 0 10, 0 0... # returns the area-weighted centroid, element-wise s2_centroid(\"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\") #> #> [1] POINT (5 5.00595863) s2_centroid(\"LINESTRING (0 0, 10 0)\") #> #> [1] POINT (5 0) # s2_point_on_surface guarantees a point on surface # Note: this is not the same as st_point_on_surface s2_centroid(\"POLYGON ((0 0, 10 0, 1 1, 0 10, 0 0))\") #> #> [1] POINT (2.00377112 2.00234355) s2_point_on_surface(\"POLYGON ((0 0, 10 0, 1 1, 0 10, 0 0))\") #> #> [1] POINT (0.450236802 0.450222902) # returns the unweighted centroid of the entire input s2_centroid_agg(c(\"POINT (0 0)\", \"POINT (10 0)\")) #> #> [1] POINT (5 0) # returns the closest point on x to y s2_closest_point( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POINT (0 90)\" # north pole! ) #> #> [1] POINT (5 10.037423) # returns the shortest possible line between x and y s2_minimum_clearance_line_between( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POINT (0 90)\" # north pole! ) #> #> [1] LINESTRING (5 10.037423, 0 90) # binary operations: difference, symmetric difference, intersection and union s2_difference( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] POLYGON ((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... s2_sym_difference( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] MULTIPOLYGON (((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... s2_intersection( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] POLYGON ((5.00000004 4.99999997, 10 5.01900178, 10 9.99999999, 5.00000004 10.0374231, 5.00000004 4.99999997... s2_union( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] POLYGON ((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... # s2_convex_hull_agg builds the convex hull of a list of geometries s2_convex_hull_agg( c( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\" ) ) #> #> [1] POLYGON ((0 0, 10 0, 15 5, 15 15, 5 15... # use s2_union_agg() to aggregate geographies in a vector s2_coverage_union_agg( c( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\" ), # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] POLYGON ((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... # snap to grid rounds coordinates to a specified grid size s2_snap_to_grid(\"POINT (0.333333333333 0.666666666666)\", 1e-2) #> #> [1] POINT (0.33 0.67)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute feature-wise and aggregate bounds — s2_bounds_cap","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"s2_bounds_rect() returns bounding latitude-longitude rectangle contains region; s2_bounds_cap() returns bounding circle represented centre point (lat, lng) angle. bound may tight points, polylines geometry collections. rectangle returned may depend order points polylines. lng_lo values larger lng_hi indicate regions span antimeridian, see Fiji example.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"","code":"s2_bounds_cap(x) s2_bounds_rect(x)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"x s2_geography() vector.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"functions return data.frame: s2_bounds_rect(): Columns minlng, minlat, maxlng, maxlat (degrees) s2_bounds_cap(): Columns lng, lat, angle (degrees)","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"","code":"s2_bounds_cap(s2_data_countries(\"Antarctica\")) #> lng lat angle #> 1 0 -90 26.72934 s2_bounds_cap(s2_data_countries(\"Netherlands\")) #> lng lat angle #> 1 5.203512 52.15706 1.792879 s2_bounds_cap(s2_data_countries(\"Fiji\")) #> lng lat angle #> 1 178.7459 -17.15444 1.801369 s2_bounds_rect(s2_data_countries(\"Antarctica\")) #> lng_lo lat_lo lng_hi lat_hi #> 1 -180 -90 180 -63.27066 s2_bounds_rect(s2_data_countries(\"Netherlands\")) #> lng_lo lat_lo lng_hi lat_hi #> 1 3.314971 50.80372 7.092053 53.5104 s2_bounds_rect(s2_data_countries(\"Fiji\")) #> lng_lo lat_lo lng_hi lat_hi #> 1 177.285 -18.28799 -179.7933 -16.02088"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":null,"dir":"Reference","previous_headings":"","what":"Create S2 Cell vectors — s2_cell","title":"Create S2 Cell vectors — s2_cell","text":"S2 cell indexing system forms basis spatial indexing S2 library. , S2 cells can represent points areas. union, vector S2 cells can approximate line polygon. functions allow direct access S2 cell indexing system designed minimal overhead looping recursion acceptable performance used within R code.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create S2 Cell vectors — s2_cell","text":"","code":"s2_cell(x = character()) s2_cell_sentinel() s2_cell_invalid() as_s2_cell(x, ...) # S3 method for class 's2_cell' as_s2_cell(x, ...) # S3 method for class 'character' as_s2_cell(x, ...) # S3 method for class 's2_geography' as_s2_cell(x, ...) # S3 method for class 'wk_xy' as_s2_cell(x, ...) # S3 method for class 'integer64' as_s2_cell(x, ...) new_s2_cell(x)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create S2 Cell vectors — s2_cell","text":"x canonical S2 cell identifier character vector. ... Passed methods","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create S2 Cell vectors — s2_cell","text":"object class s2_cell","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create S2 Cell vectors — s2_cell","text":"hood, S2 cell vectors represented R vectors type double(). works S2 cell identifiers 64 bits wide, doubles systems R runs (trick used bit64 package represent signed 64-bit integers). happy accident, NA_real_ valid meaningful cell identifier, missing value support way R users might expect preserved. worth noting underlying value s2_cell_sentinel() normally considered NA; however, meaningful useful programming S2 cells, custom .na() comparison methods implemented s2_cell_sentinel() greater valid S2 cells considered missing. Users can implement compiled code uses underlying bytes vector, ensuring class returned object interpreted way constructed new_s2_cell().","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create S2 Cell vectors — s2_cell","text":"","code":"s2_cell(\"4b59a0cd83b5de49\") #> #> [1] 4b59a0cd83b5de49 as_s2_cell(s2_lnglat(-64, 45)) #> #> [1] 4b59a0cd83b5de49 as_s2_cell(s2_data_cities(\"Ottawa\")) #> #> [1] 4cce045470cbd267"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_is_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 cell operators — s2_cell_is_valid","title":"S2 cell operators — s2_cell_is_valid","text":"S2 cell operators","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_is_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 cell operators — s2_cell_is_valid","text":"","code":"s2_cell_is_valid(x) s2_cell_debug_string(x) s2_cell_to_lnglat(x) s2_cell_center(x) s2_cell_boundary(x) s2_cell_polygon(x) s2_cell_vertex(x, k) s2_cell_level(x) s2_cell_is_leaf(x) s2_cell_is_face(x) s2_cell_area(x, radius = s2_earth_radius_meters()) s2_cell_area_approx(x, radius = s2_earth_radius_meters()) s2_cell_parent(x, level = -1L) s2_cell_child(x, k) s2_cell_edge_neighbour(x, k) s2_cell_contains(x, y) s2_cell_distance(x, y, radius = s2_earth_radius_meters()) s2_cell_max_distance(x, y, radius = s2_earth_radius_meters()) s2_cell_may_intersect(x, y) s2_cell_common_ancestor_level(x, y) s2_cell_common_ancestor_level_agg(x, na.rm = FALSE)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_is_valid.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 cell operators — s2_cell_is_valid","text":"x, y s2_cell() vector k integer 0 3 radius radius use (e.g., s2_earth_radius_meters()) level integer 0 30, inclusive. na.rm Remove NAs prior computing aggregate?","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":null,"dir":"Reference","previous_headings":"","what":"Create S2 Cell Union vectors — s2_cell_union","title":"Create S2 Cell Union vectors — s2_cell_union","text":"Create S2 Cell Union vectors","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create S2 Cell Union vectors — s2_cell_union","text":"","code":"s2_cell_union(x = list()) # S3 method for class 's2_cell_union' as_s2_geography(x, ...) as_s2_cell_union(x, ...) # S3 method for class 's2_cell_union' as_s2_cell_union(x, ...) # S3 method for class 's2_cell' as_s2_cell_union(x, ...) # S3 method for class 'character' as_s2_cell_union(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create S2 Cell Union vectors — s2_cell_union","text":"x list() s2_cell() vectors. ... Passed S3 methods","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create S2 Cell Union vectors — s2_cell_union","text":"object class \"s2_cell_union\".","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union_normalize.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 cell union operators — s2_cell_union_normalize","title":"S2 cell union operators — s2_cell_union_normalize","text":"S2 cell union operators","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union_normalize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 cell union operators — s2_cell_union_normalize","text":"","code":"s2_cell_union_normalize(x) s2_cell_union_contains(x, y) s2_cell_union_intersects(x, y) s2_cell_union_intersection(x, y) s2_cell_union_union(x, y) s2_cell_union_difference(x, y) s2_covering_cell_ids( x, min_level = 0, max_level = 30, max_cells = 8, buffer = 0, interior = FALSE, radius = s2_earth_radius_meters() ) s2_covering_cell_ids_agg( x, min_level = 0, max_level = 30, max_cells = 8, buffer = 0, interior = FALSE, radius = s2_earth_radius_meters(), na.rm = FALSE )"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union_normalize.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 cell union operators — s2_cell_union_normalize","text":"x, y s2_geography s2_cell_union(). min_level, max_level minimum maximum levels constrain covering. max_cells maximum number cells covering. Defaults 8. buffer distance buffer outside geography interior Use TRUE force covering inside geography. radius radius use (e.g., s2_earth_radius_meters()) na.rm Remove NAs prior computing aggregate?","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":null,"dir":"Reference","previous_headings":"","what":"Matrix Functions — s2_closest_feature","title":"Matrix Functions — s2_closest_feature","text":"functions similar accessors predicates, instead recycling x y common length returning vector length, functions return vector length x element containing information entire vector y relates feature x[].","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Matrix Functions — s2_closest_feature","text":"","code":"s2_closest_feature(x, y) s2_closest_edges( x, y, k, min_distance = -1, max_distance = Inf, radius = s2_earth_radius_meters() ) s2_farthest_feature(x, y) s2_distance_matrix(x, y, radius = s2_earth_radius_meters()) s2_max_distance_matrix(x, y, radius = s2_earth_radius_meters()) s2_contains_matrix(x, y, options = s2_options(model = \"open\")) s2_within_matrix(x, y, options = s2_options(model = \"open\")) s2_covers_matrix(x, y, options = s2_options(model = \"closed\")) s2_covered_by_matrix(x, y, options = s2_options(model = \"closed\")) s2_intersects_matrix(x, y, options = s2_options()) s2_disjoint_matrix(x, y, options = s2_options()) s2_equals_matrix(x, y, options = s2_options()) s2_touches_matrix(x, y, options = s2_options()) s2_dwithin_matrix(x, y, distance, radius = s2_earth_radius_meters()) s2_may_intersect_matrix(x, y, max_edges_per_cell = 50, max_feature_cells = 4)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Matrix Functions — s2_closest_feature","text":"x, y Geography vectors, coerced using as_s2_geography(). x considered source, y considered target. k number closest edges consider searching. Note S2 point also considered edge. min_distance minimum distance consider searching edges. filter applied search complete (.e., may cause fewer k values returned). max_distance maximum distance consider searching edges. filter applied search. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters(). options s2_options() object describing polygon/polyline model use snap level. distance distance surface earth units radius. max_edges_per_cell s2_may_intersect_matrix(), values controls nature index y, higher values leading coarser index. Values 10 50; default 50 adequate use cases, specialized operations users may wish use lower value increase performance. max_feature_cells s2_may_intersect_matrix(), value controls approximation x used identify potential intersections y. default value 4 gives best performance operations, specialized operations users may wish use higher value increase performance.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Matrix Functions — s2_closest_feature","text":"vector length x.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Matrix Functions — s2_closest_feature","text":"","code":"city_names <- c(\"Vatican City\", \"San Marino\", \"Luxembourg\") cities <- s2_data_cities(city_names) country_names <- s2_data_tbl_countries$name countries <- s2_data_countries() # closest feature returns y indices of the closest feature # for each feature in x country_names[s2_closest_feature(cities, countries)] #> [1] \"Italy\" \"Italy\" \"Luxembourg\" # farthest feature returns y indices of the farthest feature # for each feature in x country_names[s2_farthest_feature(cities, countries)] #> [1] \"New Zealand\" \"New Zealand\" \"New Zealand\" # use s2_closest_edges() to find the k-nearest neighbours nearest <- s2_closest_edges(cities, cities, k = 2, min_distance = 0) city_names #> [1] \"Vatican City\" \"San Marino\" \"Luxembourg\" city_names[unlist(nearest)] #> [1] \"San Marino\" \"Vatican City\" \"San Marino\" # predicate matrices country_names[s2_intersects_matrix(cities, countries)[[1]]] #> [1] \"Italy\" # distance matrices s2_distance_matrix(cities, cities) #> [,1] [,2] [,3] #> [1,] 0.0 226040.9 986762.6 #> [2,] 226040.9 0.0 792700.1 #> [3,] 986762.6 792700.1 0.0 s2_max_distance_matrix(cities, countries[1:4]) #> [,1] [,2] [,3] [,4] #> [1,] 5284474 6716222 729253.1 4488169 #> [2,] 5225941 6939199 798367.2 4551290 #> [3,] 5543951 7659266 1564998.8 5198533"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 Geography Predicates — s2_contains","title":"S2 Geography Predicates — s2_contains","text":"functions operate two geography vectors (pairwise), return logical vector.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 Geography Predicates — s2_contains","text":"","code":"s2_contains(x, y, options = s2_options(model = \"open\")) s2_within(x, y, options = s2_options(model = \"open\")) s2_covered_by(x, y, options = s2_options(model = \"closed\")) s2_covers(x, y, options = s2_options(model = \"closed\")) s2_disjoint(x, y, options = s2_options()) s2_intersects(x, y, options = s2_options()) s2_equals(x, y, options = s2_options()) s2_intersects_box( x, lng1, lat1, lng2, lat2, detail = 1000, options = s2_options() ) s2_touches(x, y, options = s2_options()) s2_dwithin(x, y, distance, radius = s2_earth_radius_meters()) s2_prepared_dwithin(x, y, distance, radius = s2_earth_radius_meters())"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 Geography Predicates — s2_contains","text":"x, y geography vectors. inputs passed as_s2_geography(), can pass objects (e.g., character vectors well-known text) directly. options s2_options() object describing polygon/polyline model use snap level. lng1, lat1, lng2, lat2 latitude/longitude range detail number points approximate non-geodesic edges. distance distance surface earth units radius. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters().","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"model","dir":"Reference","previous_headings":"","what":"Model","title":"S2 Geography Predicates — s2_contains","text":"geometry model indicates whether geometry includes boundaries. Boundaries line geometries end points. OPEN geometries contain boundary (model = \"open\"); CLOSED geometries (model = \"closed\") contain boundary; SEMI-OPEN geometries (model = \"semi-open\") contain half boundaries, two polygons overlap two lines cross, point exist belong one geometries. (latter form, half-closed, present OpenGIS \"simple feature access\" (SFA) standard DE9-IM based). default values s2_contains() (open) covers/covered_by (closed) correspond SFA standard specification operators.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"S2 Geography Predicates — s2_contains","text":"","code":"s2_contains( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_within( c(\"POINT (5 5)\", \"POINT (-1 1)\"), \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\" ) #> [1] TRUE FALSE s2_covered_by( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] FALSE FALSE s2_covers( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_disjoint( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] FALSE TRUE s2_intersects( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_equals( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((10 0, 10 10, 0 10, 0 0, 10 0))\", \"POLYGON ((-1 -1, 10 0, 10 10, 0 10, -1 -1))\" ) ) #> [1] TRUE TRUE FALSE s2_intersects( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_intersects_box( c(\"POINT (5 5)\", \"POINT (-1 1)\"), 0, 0, 10, 10 ) #> [1] TRUE FALSE s2_touches( \"POLYGON ((0 0, 0 1, 1 1, 0 0))\", c(\"POINT (0 0)\", \"POINT (0.5 0.75)\", \"POINT (0 0.5)\") ) #> [1] TRUE FALSE FALSE s2_dwithin( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\"), 0 # distance in meters ) #> [1] TRUE FALSE s2_dwithin( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\"), 1e6 # distance in meters ) #> [1] TRUE TRUE"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_example_wkt.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Geometries — s2_data_example_wkt","title":"Example Geometries — s2_data_example_wkt","text":"geometries toy examples useful testing various coordinate shuffling operations s2 package.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_example_wkt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example Geometries — s2_data_example_wkt","text":"","code":"s2_data_example_wkt"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_example_wkt.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Example Geometries — s2_data_example_wkt","text":"object class list length 29.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":null,"dir":"Reference","previous_headings":"","what":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"Well-known binary versions Natural Earth low-resolution world boundaries timezone boundaries.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"","code":"s2_data_tbl_countries s2_data_tbl_timezones s2_data_tbl_cities s2_data_countries(name = NULL) s2_data_timezones(utc_offset_min = NULL, utc_offset_max = utc_offset_min) s2_data_cities(name = NULL)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"data.frame columns name (character), geometry (wk_wkb) object class data.frame 120 rows 2 columns. object class data.frame 243 rows 3 columns.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"Natural Earth Data","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"name name country, continent, city, NULL features. utc_offset_min, utc_offset_max Minimum /maximum timezone offsets.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"","code":"head(s2_data_countries()) #> #> [1] POLYGON ((61.2108171 35.6500723, 60.8031934 34.4041019, 60.5284298 33.676446, 60.9637004 33.5288323, 60.5360779 32.9812688... #> [2] MULTIPOLYGON (((16.3265284 -5.8774704, 13.3755974 -5.8642412, 13.0248694 -5.9843889, 12.7351713 -5.9656821, 12.3224317 -6.1000925... #> [3] POLYGON ((20.5902474 41.8554042, 20.52295 42.21787, 20.2837545 42.3202595, 20.0707 42.58863, 19.8016134 42.5000935... #> [4] POLYGON ((51.5795187 24.2454971, 51.6177076 24.0142193, 52.0007333 23.0011545, 55.006803 22.4969475, 55.2083411 22.70833... #> [5] MULTIPOLYGON (((-65.5 -55.2, -65.05 -54.7, -66.45 -54.45, -67.75 -53.85, -68.25 -53.1... #> [6] POLYGON ((43.5827458 41.0921433, 43.7526579 40.7402009, 43.6564364 40.253564, 44.4000086 40.0050003, 44.7939897 39.7130026... s2_data_countries(\"Germany\") #> #> [1] POLYGON ((9.9219064 54.9831042, 9.2820488 54.8308654, 8.5262293 54.9627436, 8.572118 54.3956465, 8.8007345 54.0207856... s2_data_countries(\"Europe\") #> #> [1] POLYGON ((20.5902474 41.8554042, 20.52295 42.21787, 20.2837545 42.3202595, 20.0707 42.58863, 19.8016134 42.5000935... #> [2] POLYGON ((16.9796668 48.123497, 16.8799829 48.4700133, 16.9602881 48.5969823, 16.4992827 48.785808, 16.0296473 48.733899... #> [3] POLYGON ((3.3149711 51.345781, 2.513573 51.1485062, 2.6584221 50.796848, 3.1232516 50.7803633, 3.5881844 50.3789924... #> [4] POLYGON ((22.6571497 44.234923, 22.4104464 44.0080635, 22.5001567 43.6428144, 22.9860185 43.2111612, 22.6048015 42.8985188... #> [5] POLYGON ((19.0054863 44.8602337, 18.5532141 45.0815897, 17.8617835 45.0677404, 17.002146 45.2337768, 16.5349394 45.2116076... #> [6] POLYGON ((23.4841276 53.9124977, 23.5275358 53.4701216, 23.8049349 53.0897314, 23.7991988 52.6910994, 23.1994938 52.4869774... #> [7] POLYGON ((9.5942261 47.5250581, 8.5226119 47.8308275, 8.3173015 47.6135798, 7.4667591 47.620582, 7.1922022 47.4497655... #> [8] POLYGON ((16.9602881 48.5969823, 17.1019849 48.8169689, 17.545007 48.800019, 17.8864848 48.9034752, 17.9135116 48.9964928... #> [9] POLYGON ((9.9219064 54.9831042, 9.2820488 54.8308654, 8.5262293 54.9627436, 8.572118 54.3956465, 8.8007345 54.0207856... #> [10] MULTIPOLYGON (((12.6900061 55.609991, 12.3709042 56.1114074, 10.9039136 55.7799547, 11.0435433 55.3648638, 12.0899911 54.8000146... #> [11] POLYGON ((-9.0348177 41.8805706, -8.6719458 42.1346894, -8.263857 42.2804687, -8.0131746 41.7908861, -7.422513 41.7920747... #> [12] POLYGON ((24.3128626 57.7934236, 25.1645935 57.970157, 25.6028097 57.8475288, 26.4635323 57.4763887, 27.2881848 57.4745283... #> [13] POLYGON ((28.5919296 69.0647769, 29.015573 69.7664912, 27.7322921 70.164193, 26.179622 69.825299, 25.6892127 69.0921138... #> [14] MULTIPOLYGON (((-52.5564247 2.5047053, -52.2493375 3.2410945, -51.6577974 4.1562324, -51.8233429 4.5657681, -52.8821413 5.409851... #> [15] MULTIPOLYGON (((-5.6619486 54.5546032, -6.733847 55.17286, -7.5721679 55.1316222, -7.3660306 54.595841, -7.5721679 54.0599564... #> [16] MULTIPOLYGON (((23.6999801 35.7050044, 23.5149785 35.2799916, 24.7350074 35.0849905, 24.7249821 34.9199877, 26.1649976 35.0049954... #> [17] POLYGON ((18.8298381 45.9088777, 18.4560625 45.7594811, 17.6300664 45.9517691, 16.8825151 46.3806318, 16.5648084 46.5037509... #> [18] POLYGON ((16.2022982 46.852386, 16.370505 46.8413272, 16.5648084 46.5037509, 16.8825151 46.3806318, 17.6300664 45.9517691... #> [19] POLYGON ((-6.1978849 53.867565, -6.9537302 54.0737023, -7.5721679 54.0599564, -7.3660306 54.595841, -7.5721679 55.1316222... #> [20] POLYGON ((-14.5086954 66.4558922, -16.167819 66.5267923, -17.7986238 65.9938533, -19.0568416 66.2766009, -20.5762837 65.7321121... #> [21] MULTIPOLYGON (((15.520376 38.2311551, 14.7612492 38.1438736, 13.7411564 38.0349655, 12.5709436 38.1263811, 12.4310039 37.6129499... #> [22] POLYGON ((20.76216 42.05186, 21.3527 42.2068, 21.576636 42.2452244, 21.54332 42.32025, 21.66292 42.43922... #> [23] POLYGON ((22.7310987 54.3275369, 23.2439873 54.2205667, 23.4841276 53.9124977, 24.4506836 53.9057022, 25.5363538 54.2824234... #> [24] POLYGON ((6.0430734 50.1280517, 5.7824174 50.0903279, 5.674052 49.5294835, 5.8977592 49.4426671, 6.1863204 49.4638028... #> [25] POLYGON ((21.0558004 56.0310764, 22.2011569 56.3378018, 23.8782638 56.2736714, 24.8606844 56.3725284, 25.0009343 56.1645307... #> [26] POLYGON ((26.6193368 48.2207262, 26.9241761 48.1232645, 27.2338729 47.8267709, 27.5511662 47.4051171, 28.1280302 46.8104764... #> [27] POLYGON ((20.59023 41.85541, 20.46315 41.51509, 20.60518 41.08622, 21.0200403 40.842727, 21.6741606 40.9312745... #> [28] POLYGON ((19.8016134 42.5000935, 20.0707 42.58863, 20.25758 42.81275, 20.3398 42.89852, 19.95857 43.10604... #> [29] POLYGON ((6.0741826 53.5104033, 4.7059973 53.0917984, 3.8302885 51.6205445, 3.3149711 51.3457551, 4.0470712 51.2672586... #> [30] MULTIPOLYGON (((28.1655473 71.1854744, 26.3700497 70.9862617, 24.5465434 71.0304967, 23.0237423 70.2020718, 21.3784164 70.2551694... #> [31] POLYGON ((15.0169959 51.1066741, 15.4909721 50.7847299, 16.2386267 50.6977327, 16.1762533 50.4226073, 16.7194759 50.2157466... #> [32] POLYGON ((-9.0348177 41.8805706, -8.9907894 41.5434594, -8.7908532 41.184334, -8.768684 40.7606389, -8.9773535 40.1593061... #> [33] POLYGON ((22.7105314 47.8821939, 22.0997677 47.6724393, 21.6265149 46.9942378, 21.0219523 46.316088, 20.2201925 46.127469... #> [34] MULTIPOLYGON (((143.648007 50.7476004, 143.235268 51.7566603, 143.260848 52.7407604, 142.914615 53.7045775, 142.654786 54.3658808... #> [35] POLYGON ((20.8743128 45.4163754, 20.7621749 45.7345731, 20.2201925 46.127469, 19.5960445 46.1717298, 18.82982 45.90888... #> [36] POLYGON ((18.8531442 49.4962298, 18.5549711 49.4950154, 18.3999935 49.3150005, 18.1704985 49.2715148, 18.1049728 49.0439835... #> [37] POLYGON ((13.8064755 46.5093061, 13.69811 46.0167781, 13.9376302 45.5910159, 13.7150598 45.5003238, 14.4119682 45.4661657... #> [38] POLYGON ((22.1831735 65.7237405, 23.9033785 66.0069274, 23.5658798 66.3960509, 23.5394731 67.9360086, 21.9785348 68.6168456... #> [39] POLYGON ((31.7859982 52.101678, 30.9275493 52.0423534, 30.6194544 51.8228061, 30.5551172 51.3195035, 30.1573637 51.4161384... head(s2_data_timezones()) #> #> [1] POLYGON ((-142.530008 89.9, -157.52562 89.9, -157.525959 85.257726, -157.525963 80.615452, -157.525964 75.9731781... #> [2] POLYGON ((179.9 48.0498729, 179.9 53.7458252, 179.9 59.4417774, 177.269342 57.8252945, 174.9285 56.3300414... #> [3] POLYGON ((-157.52562 89.9, -172.509033 89.9, -172.508484 85.048013, -172.508478 80.1960259, -172.508476 75.3440389... #> [4] POLYGON ((-172.483 15.0205262, -172.500008 14.9990848, -172.501035 6.24488388, -172.502027 -2.50931703, -165.4943 -2.52823772... #> [5] POLYGON ((-179.9 34.9987943, -179.9 29.9990794, -178.046725 30.0025387, -178.046725 27.5915348, -176.346743 27.5914979... #> [6] POLYGON ((-167.997656 -5.84229697, -169.396078 -5.84229697, -170.992788 -9.42836242, -171.293786 -11.0572656, -171.003287 -13.9679213... s2_data_timezones(-4) #> #> [1] POLYGON ((-52.543144 89.9, -67.5030209 89.9, -67.5030209 83.1870838, -66.2483102 83.1525808, -65.3278911 83.1046193... #> [2] POLYGON ((-55.9540449 46.6167698, -56.1509228 46.5543787, -56.1515514 46.3058973, -56.4049242 46.3064124, -56.4050827 46.3676109... #> [3] POLYGON ((-67.4927669 -89.9, -52.5322527 -89.9, -52.5326913 -83.4592992, -52.5326947 -77.0185985, -61.1288044 -75.0218643... head(s2_data_cities()) #> #> [1] POINT (12.4533865 41.9032822) POINT (12.4417702 43.9360958) #> [3] POINT (9.51666947 47.1337238) POINT (31.1999971 -26.4666675) #> [5] POINT (6.13000281 49.6116604) POINT (158.149974 6.9166437) s2_data_cities(\"Cairo\") #> #> [1] POINT (31.2480224 30.0519062)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":null,"dir":"Reference","previous_headings":"","what":"Earth Constants — s2_earth_radius_meters","title":"Earth Constants — s2_earth_radius_meters","text":"According Yoder (1995), radius earth 6371.01 km. functions used set default radis functions return distance accept distance input (e.g., s2_distance() s2_dwithin()).","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Earth Constants — s2_earth_radius_meters","text":"","code":"s2_earth_radius_meters()"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Earth Constants — s2_earth_radius_meters","text":"Yoder, C.F. 1995. \"Astrometric Geodetic Properties Earth Solar System\" Global Earth Physics, Handbook Physical Constants, AGU Reference Shelf 1, American Geophysical Union, Table 2. doi:10.1029/RF001p0001","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Earth Constants — s2_earth_radius_meters","text":"","code":"s2_earth_radius_meters() #> [1] 6371010"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":null,"dir":"Reference","previous_headings":"","what":"Create and Format Geography Vectors — s2_geog_point","title":"Create and Format Geography Vectors — s2_geog_point","text":"functions create export geography vectors. Unlike BigQuery geography constructors, functions sanitize invalid redundant input using s2_union(). Note creating polygons using s2_make_polygon(), rings can open closed.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create and Format Geography Vectors — s2_geog_point","text":"","code":"s2_geog_point(longitude, latitude) s2_make_line(longitude, latitude, feature_id = 1L) s2_make_polygon( longitude, latitude, feature_id = 1L, ring_id = 1L, oriented = FALSE, check = TRUE ) s2_geog_from_text( wkt_string, oriented = FALSE, check = TRUE, planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_geog_from_wkb( wkb_bytes, oriented = FALSE, check = TRUE, planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_as_text( x, precision = 16, trim = TRUE, planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_as_binary( x, endian = wk::wk_platform_endian(), planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_tessellate_tol_default()"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create and Format Geography Vectors — s2_geog_point","text":"longitude, latitude Vectors latitude longitude feature_id, ring_id Vectors change sequential values indicates new feature ring. Use factor() convert character vector. oriented TRUE polygon ring directions known correct (.e., exterior rings defined counter clockwise interior rings defined clockwise). check Use check = FALSE skip error invalid geometries wkt_string Well-known text planar Use TRUE force planar edges import export. tessellate_tol_m maximum number meters point must moved satisfy planar edge constraint. wkb_bytes list() raw() x object can converted s2_geography vector precision number significant digits export writing well-known text. trim = FALSE, number digits decimal place. trim trailing zeroes included decimal place? endian endian-ness well-known binary. See wk::wkb_translate_wkb().","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create and Format Geography Vectors — s2_geog_point","text":"","code":"# create point geographies using coordinate values: s2_geog_point(-64, 45) #> #> [1] POINT (-64 45) # create line geographies using coordinate values: s2_make_line(c(-64, 8), c(45, 71)) #> #> [1] LINESTRING (-64 45, 8 71) # optionally, separate features using feature_id: s2_make_line( c(-64, 8, -27, -27), c(45, 71, 0, 45), feature_id = c(1, 1, 2, 2) ) #> #> [1] LINESTRING (-64 45, 8 71) LINESTRING (-27 0, -27 45) # create polygon geographies using coordinate values: # (rings can be open or closed) s2_make_polygon(c(-45, 8, 0), c(64, 71, 90)) #> #> [1] POLYGON ((-45 64, 8 71, 0 90, -45 64)) # optionally, separate rings and/or features using # ring_id and/or feature_id s2_make_polygon( c(20, 10, 10, 30, 45, 30, 20, 20, 40, 20, 45), c(35, 30, 10, 5, 20, 20, 15, 25, 40, 45, 30), feature_id = c(rep(1, 8), rep(2, 3)), ring_id = c(1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1) ) #> #> [1] POLYGON ((20 35, 10 30, 10 10, 30 5, 45 20... #> [2] POLYGON ((40 40, 20 45, 45 30, 40 40)) # import and export well-known text (geog <- s2_geog_from_text(\"POINT (-64 45)\")) #> #> [1] POINT (-64 45) s2_as_text(geog) #> [1] \"POINT (-64 45)\" # import and export well-known binary (geog <- s2_geog_from_wkb(wk::as_wkb(\"POINT (-64 45)\"))) #> #> [1] POINT (-64 45) s2_as_binary(geog) #> [[1]] #> [1] 01 01 00 00 00 00 00 00 00 00 00 50 c0 00 00 00 00 00 80 46 40 #> #> attr(,\"class\") #> [1] \"blob\" # import geometry from planar space s2_geog_from_text( \"POLYGON ((0 0, 1 0, 0 1, 0 0))\", planar = TRUE, tessellate_tol_m = 1 ) #> #> [1] POLYGON ((0 0, 1 0, 0.5 0.5, 0.25 0.75, 0 1... # export geographies into planar space geog <- s2_make_polygon(c(179, -179, 179), c(10, 10, 11)) s2_as_text(geog, planar = TRUE) #> [1] \"POLYGON ((179 10, 180 10.00149252698408, 181 10, 180.0016175935936 10.50156386165192, 179 11, 179 10))\" # polygons containing a pole need an extra step geog <- s2_data_countries(\"Antarctica\") geom <- s2_as_text( s2_intersection(geog, s2_world_plate_carree()), planar = TRUE )"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":null,"dir":"Reference","previous_headings":"","what":"Linear referencing — s2_project","title":"Linear referencing — s2_project","text":"Linear referencing","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Linear referencing — s2_project","text":"","code":"s2_project(x, y, radius = s2_earth_radius_meters()) s2_project_normalized(x, y) s2_interpolate(x, distance, radius = s2_earth_radius_meters()) s2_interpolate_normalized(x, distance_normalized)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Linear referencing — s2_project","text":"x simple polyline geography vector y simple point geography vector. point snapped nearest point x purposes interpolation. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters(). distance distance along x radius units. distance_normalized distance normalized s2_length() x.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Linear referencing — s2_project","text":"s2_interpolate() returns point x, distance meters along line. s2_interpolate_normalized() returns point x interpolated fraction along line. s2_project() returns distance point occurs along x. s2_project_normalized() returns distance_normalized along x point occurs.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Linear referencing — s2_project","text":"","code":"s2_project_normalized(\"LINESTRING (0 0, 0 90)\", \"POINT (0 22.5)\") #> [1] 0.25 s2_project(\"LINESTRING (0 0, 0 90)\", \"POINT (0 22.5)\") #> [1] 2501890 s2_interpolate_normalized(\"LINESTRING (0 0, 0 90)\", 0.25) #> #> [1] POINT (0 22.5) s2_interpolate(\"LINESTRING (0 0, 0 90)\", 2501890) #> #> [1] POINT (0 22.500002)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 Geography Accessors — s2_is_collection","title":"S2 Geography Accessors — s2_is_collection","text":"Accessors extract information geography vectors.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 Geography Accessors — s2_is_collection","text":"","code":"s2_is_collection(x) s2_is_valid(x) s2_is_valid_detail(x) s2_dimension(x) s2_num_points(x) s2_is_empty(x) s2_area(x, radius = s2_earth_radius_meters()) s2_length(x, radius = s2_earth_radius_meters()) s2_perimeter(x, radius = s2_earth_radius_meters()) s2_x(x) s2_y(x) s2_distance(x, y, radius = s2_earth_radius_meters()) s2_max_distance(x, y, radius = s2_earth_radius_meters())"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 Geography Accessors — s2_is_collection","text":"x, y geography vectors. inputs passed as_s2_geography(), can pass objects (e.g., character vectors well-known text) directly. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters().","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"S2 Geography Accessors — s2_is_collection","text":"","code":"# s2_is_collection() tests for multiple geometries in one feature s2_is_collection(c(\"POINT (-64 45)\", \"MULTIPOINT ((-64 45), (8 72))\")) #> [1] FALSE TRUE # s2_dimension() returns 0 for point, 1 for line, 2 for polygon s2_dimension( c( \"GEOMETRYCOLLECTION EMPTY\", \"POINT (-64 45)\", \"LINESTRING (-64 45, 8 72)\", \"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\", \"GEOMETRYCOLLECTION (POINT (-64 45), LINESTRING (-64 45, 8 72))\" ) ) #> [1] -1 0 1 2 1 # s2_num_points() counts points s2_num_points(c(\"POINT (-64 45)\", \"LINESTRING (-64 45, 8 72)\")) #> [1] 1 2 # s2_is_empty tests for emptiness s2_is_empty(c(\"POINT (-64 45)\", \"POINT EMPTY\")) #> [1] FALSE TRUE # calculate area, length, and perimeter s2_area(\"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\") #> [1] 1.233205e+12 s2_perimeter(\"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\") #> [1] 4430869 s2_length(s2_boundary(\"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\")) #> [1] 4430869 # extract x and y coordinates from points s2_x(c(\"POINT (-64 45)\", \"POINT EMPTY\")) #> [1] -64 NaN s2_y(c(\"POINT (-64 45)\", \"POINT EMPTY\")) #> [1] 45 NaN # calculate minimum and maximum distance between two geometries s2_distance( \"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\", \"POINT (-64 45)\" ) #> [1] 7189418 s2_max_distance( \"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\", \"POINT (-64 45)\" ) #> [1] 8757818"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an S2 LngLat Vector — s2_lnglat","title":"Create an S2 LngLat Vector — s2_lnglat","text":"class represents latitude longitude Earth's surface. calculations S2 convert as_s2_point(), unit vector representation value.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an S2 LngLat Vector — s2_lnglat","text":"","code":"s2_lnglat(lng, lat) as_s2_lnglat(x, ...) # Default S3 method as_s2_lnglat(x, ...) # S3 method for class 'wk_xy' as_s2_lnglat(x, ...) # S3 method for class 'wk_xyz' as_s2_lnglat(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an S2 LngLat Vector — s2_lnglat","text":"lat, lng Vectors latitude longitude values degrees. x s2_lnglat() vector object can coerced one. ... Unused","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an S2 LngLat Vector — s2_lnglat","text":"object class s2_lnglat","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an S2 LngLat Vector — s2_lnglat","text":"","code":"s2_lnglat(45, -64) # Halifax, Nova Scotia! #> #> [1] (45 -64) as.data.frame(s2_lnglat(45, -64)) #> x y #> 1 45 -64"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Geography Operation Options — s2_options","title":"Geography Operation Options — s2_options","text":"functions specify defaults options used perform operations construct geometries. used predicates (e.g., s2_intersects()), boolean operations (e.g., s2_intersection()) specify model containment new geometries constructed.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Geography Operation Options — s2_options","text":"","code":"s2_options( model = NULL, snap = s2_snap_identity(), snap_radius = -1, duplicate_edges = FALSE, edge_type = \"directed\", validate = FALSE, polyline_type = \"path\", polyline_sibling_pairs = \"keep\", simplify_edge_chains = FALSE, split_crossing_edges = FALSE, idempotent = FALSE, dimensions = c(\"point\", \"polyline\", \"polygon\") ) s2_snap_identity() s2_snap_level(level) s2_snap_precision(precision) s2_snap_distance(distance)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Geography Operation Options — s2_options","text":"model One 'open', 'semi-open' (default polygons), 'closed' (default polylines). See section 'Model' snap Use s2_snap_identity(), s2_snap_distance(), s2_snap_level(), s2_snap_precision() specify coordinate rounding occur. snap_radius opposed snap function, specifies maximum distance vertex move, snap radius (radians) sets minimum distance vertices output cause vertices move distance specified snap function. can used simplify result boolean operation. Use -1 specify minimum distance acceptable. duplicate_edges Use TRUE keep duplicate edges (e.g., duplicate points). edge_type One 'directed' (default) 'undirected'. validate Use TRUE validate result builder. polyline_type One 'path' (default) 'walk'. 'walk', polylines backtrack preserved. polyline_sibling_pairs One 'discard' (default) 'keep'. simplify_edge_chains Use TRUE remove vertices within snap_radius original vertex. split_crossing_edges Use TRUE split crossing polyline edges creating geometries. idempotent Use FALSE apply snap even snapping necessary satisfy vertex constraints. dimensions combination 'point', 'polyline', /'polygon' can used constrain output s2_rebuild() boolean operation. level value 0 30 corresponding cell level snapping occur. precision number coordinates multiplied rounded. Rounded nearest exponent 10. distance distance (radians) denoting maximum distance vertex move snapping process.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"model","dir":"Reference","previous_headings":"","what":"Model","title":"Geography Operation Options — s2_options","text":"geometry model indicates whether geometry includes boundaries. Boundaries line geometries end points. OPEN geometries contain boundary (model = \"open\"); CLOSED geometries (model = \"closed\") contain boundary; SEMI-OPEN geometries (model = \"semi-open\") contain half boundaries, two polygons overlap two lines cross, point exist belong one geometries. (latter form, half-closed, present OpenGIS \"simple feature access\" (SFA) standard DE9-IM based). default values s2_contains() (open) covers/covered_by (closed) correspond SFA standard specification operators.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Geography Operation Options — s2_options","text":"","code":"# use s2_options() to specify containment models, snap level # layer creation options, and builder options s2_options(model = \"closed\", snap = s2_snap_level(30)) #> $model #> [1] 3 #> #> $snap #> $level #> [1] 30 #> #> attr(,\"class\") #> [1] \"snap_level\" #> #> $snap_radius #> [1] -1 #> #> $duplicate_edges #> [1] FALSE #> #> $edge_type #> [1] 1 #> #> $validate #> [1] FALSE #> #> $polyline_type #> [1] 1 #> #> $polyline_sibling_pairs #> [1] 2 #> #> $simplify_edge_chains #> [1] FALSE #> #> $split_crossing_edges #> [1] FALSE #> #> $idempotent #> [1] FALSE #> #> $dimensions #> [1] 1 2 3 #> #> attr(,\"class\") #> [1] \"s2_options\""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot S2 Geographies — s2_plot","title":"Plot S2 Geographies — s2_plot","text":"Plot S2 Geographies","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot S2 Geographies — s2_plot","text":"","code":"s2_plot( x, ..., asp = 1, xlab = \"\", ylab = \"\", rule = \"evenodd\", add = FALSE, plot_hemisphere = FALSE, simplify = TRUE, centre = NULL )"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot S2 Geographies — s2_plot","text":"x wkb() wkt() ... Passed plotting functions features: graphics::points() point multipoint geometries, graphics::lines() linestring multilinestring geometries, graphics::polypath() polygon multipolygon geometries. asp, xlab, ylab Passed graphics::plot() rule rule use filling polygons (see graphics::polypath()) add new plot created, handleable added existing plot? plot_hemisphere Plot outline earth simplify Use FALSE skip simplification step centre longitude/latitude point centre orthographic projection","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot S2 Geographies — s2_plot","text":"input, invisibly","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot S2 Geographies — s2_plot","text":"","code":"s2_plot(s2_data_countries()) s2_plot(s2_data_cities(), add = TRUE)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an S2 Point Vector — s2_point","title":"Create an S2 Point Vector — s2_point","text":"S2 terminology, \"point\" 3-dimensional unit vector representation s2_point(). Internally, s2 objects stored 3-dimensional unit vectors.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an S2 Point Vector — s2_point","text":"","code":"s2_point(x, y, z) s2_point_crs() as_s2_point(x, ...) # Default S3 method as_s2_point(x, ...) # S3 method for class 'wk_xy' as_s2_point(x, ...) # S3 method for class 'wk_xyz' as_s2_point(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an S2 Point Vector — s2_point","text":"x, y, z Vectors latitude longitude values degrees. ... Unused","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an S2 Point Vector — s2_point","text":"object class s2_point","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an S2 Point Vector — s2_point","text":"","code":"point <- s2_lnglat(-64, 45) # Halifax, Nova Scotia! as_s2_point(point) #> #> [1] Z (0.3099752 -0.6355434 0.7071068) as.data.frame(as_s2_point(point)) #> x y z #> 1 0.3099752 -0.6355434 0.7071068"},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":null,"dir":"Reference","previous_headings":"","what":"Low-level wk filters and handlers — wk_handle.s2_geography","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"Low-level wk filters handlers","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"","code":"# S3 method for class 's2_geography' wk_handle( handleable, handler, ..., s2_projection = s2_projection_plate_carree(), s2_tessellate_tol = Inf ) s2_geography_writer( oriented = FALSE, check = TRUE, projection = s2_projection_plate_carree(), tessellate_tol = Inf ) # S3 method for class 's2_geography' wk_writer(handleable, ...) s2_trans_point() s2_trans_lnglat() s2_projection_plate_carree(x_scale = 180) s2_projection_mercator(x_scale = 20037508.3427892) s2_hemisphere(centre) s2_world_plate_carree(epsilon_east_west = 0, epsilon_north_south = 0) s2_projection_orthographic(centre = s2_lnglat(0, 0))"},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"handleable geometry vector (e.g., wkb(), wkt(), xy(), rct(), sf::st_sfc()) wk_handle() defined. handler wk_handler object. ... Passed wk_handle() method. oriented TRUE polygon ring directions known correct (.e., exterior rings defined counter clockwise interior rings defined clockwise). check Use check = FALSE skip error invalid geometries projection, s2_projection One s2_projection_plate_carree() s2_projection_mercator() tessellate_tol, s2_tessellate_tol angle radians. Points added line segment within distance point. x_scale maximum x value projection centre center point orthographic projection epsilon_east_west, epsilon_north_south Use positive number define edges Cartesian world slightly inward -180, -90, 180, 90. may used define world outline projection projecting extreme edges earth results non-finite value.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"s2_projection_plate_carree(), s2_projection_mercator(): external pointer S2 projection.","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-development-version","dir":"Changelog","previous_headings":"","what":"s2 (development version)","title":"s2 (development version)","text":"Abseil dependency resolved using pkg-config possible. possible, vendored version Abseil built using CMake (#258).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-117","dir":"Changelog","previous_headings":"","what":"s2 1.1.7","title":"s2 1.1.7","text":"CRAN release: 2024-07-17 modify src/Makevars.ucrt longer uses rwinlib; requested TK","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-116","dir":"Changelog","previous_headings":"","what":"s2 1.1.6","title":"s2 1.1.6","text":"CRAN release: 2023-12-19 Fix CRAN warning (#254).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-115","dir":"Changelog","previous_headings":"","what":"s2 1.1.5","title":"s2 1.1.5","text":"CRAN release: 2023-12-10 fix compiler problem Alpine 3.19.0 (#251)","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-114","dir":"Changelog","previous_headings":"","what":"s2 1.1.4","title":"s2 1.1.4","text":"CRAN release: 2023-05-17 Updated tests pass forthcoming waldo package update (#237).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-113","dir":"Changelog","previous_headings":"","what":"s2 1.1.3","title":"s2 1.1.3","text":"CRAN release: 2023-04-27 Made test less strict pass tests Alpine Linux (#218, #220). Updated tests pass forthcoming waldo package update (@hadley, #226). Updated vendored file modifications suppress multi-line comment warning gcc (#214, #227).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-112","dir":"Changelog","previous_headings":"","what":"s2 1.1.2","title":"s2 1.1.2","text":"CRAN release: 2023-01-12 Fixed test .data.frame() s2_cell() comply new wk version latest release R (#207). Fix unary union empty multipolygon (#208). Added #include Abseil header fix compilation gcc13 (#209, #210). Update internal Abseil 20220623.1 LTS (#213).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-111","dir":"Changelog","previous_headings":"","what":"s2 1.1.1","title":"s2 1.1.1","text":"CRAN release: 2022-11-17 Fix new CRAN check warnings (#202, #203).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-110","dir":"Changelog","previous_headings":"","what":"s2 1.1.0","title":"s2 1.1.0","text":"CRAN release: 2022-07-18 Fix s2 build Windows R <= 3.6.x (#142) Fix s2 build MacOS multiple openssl versions (#142, #145, #146) Fix s2 build 32-bit openssl (#143, #147) Added s2_convex_hull() s2_convex_hull_agg() (@spiry34, #150, #151, #163). Added max_distance argument s2_closest_edges(), making distance-constrained k-nearest neighbours possible (#125, #156, #162). Added spherical s2_point_on_surface() implementation polygons (@kylebutts, #152, #161) Added s2_cell_union() vector class represent cell coverings operators generate s2 geography vector (e.g., s2_covering_cell_ids()). Cell unions useful compact representations spherical geometry can used like bounding box determine possible intersection one geographies (#85, #94, #164). Refactored simple features compatability layer standalone code base potential future use Python adaptation (#165). Migrate input output non-deprecated wk package handlers writers (#101, #165, #168). Make s2_union_agg() efficient using recursive merge strategy (#103, #165). Fix package build Raspberry Pi (#169, #171). Fix warning clang14 compiling -O0 (#167, #172). Added s2_prepared_dwithin() fixed s2_dwithin_matrix() efficiently uses index (#157, #174). Updated s2_lnglat() s2_point() use wk::xy() (record-style vctr) represent point coordinates. much faster previous representation relied list() external pointers (#181, #159). Added arguments planar tessellate_tol_m s2_as_text(), s2_as_binary(). Use planar = TRUE set tessellate_tol_m maximum error use-case automatically subdivide edges preserve “straight” lines Plate carree projection import (#182). Added arguments planar tessellate_tol_m s2_geog_from_text(), s2_geog_from_wkb(). Use planar = TRUE set tessellate_tol_m maximum error use-case automatically subdivide edges ensure “straight” lines Plate carree projection export (#182).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-107","dir":"Changelog","previous_headings":"","what":"s2 1.0.7","title":"s2 1.0.7","text":"CRAN release: 2021-09-28 Update internal copy s2geometry use updated Abseil, fixing compiler warning gcc-11 (#79, #134).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-106","dir":"Changelog","previous_headings":"","what":"s2 1.0.6","title":"s2 1.0.6","text":"CRAN release: 2021-06-17 Added support STRICT_R_HEADERS (@eddelbuettel, #118). Fixed bug result s2_centroid_agg() behave like normal point distance calculations (#119, #121). Fixed Windows UCRT check failure updated openssl linking (@jeroen, #122).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-105","dir":"Changelog","previous_headings":"","what":"s2 1.0.5","title":"s2 1.0.5","text":"CRAN release: 2021-06-01 Added s2_projection_filter() s2_unprojection_filter() expose S2 edge tessellator, can used make Cartesian great circle assumptions line segments explicit adding points necessary (#115). Added s2_cell() vector class expose subset S2 indexing system R users (#85, #114). Added s2_closest_edges() make k-nearest neighbours calculation possible sphere (#111, #112). Added s2_interpolate(), s2_interpolate_normalized(), s2_project(), s2_project_normalized() provide linear referencing support sphere (#96, #110). Fixed import empty points WKB (#109). Added argument dimensions s2_options() constrain output dimensions boolean rebuild operation (#105, #104, #110). Added s2_is_valid() s2_is_valid_detail() help find invalid spherical geometries importing data S2 (#100). Improved error messages importing processing data errors can debugged readily (#100, #98). unary version s2_union() can now handle MULTIPOLYGON geometries overlapping rings addition invalid polygons. s2_union() can now sanitize almost input valid spherical geometry minimal modification (#100, #99). Renamed existing implementation s2_union_agg() s2_coverage_union_agg() make clear function works individual geometries overlapping interiors. s2_union_agg() replaced true aggregate union can handle unions geometries (#100, #97). Added s2_rebuild_agg() match s2_union_agg(). Like s2_rebuild(), s2_rebuild_agg() collects edges input builds feature, optionally snapping simplifying vertices process (#100).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-104","dir":"Changelog","previous_headings":"","what":"s2 1.0.4","title":"s2 1.0.4","text":"CRAN release: 2021-01-05 Fixed errors resulted compilation clang 12.2 (#88, #89).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-103","dir":"Changelog","previous_headings":"","what":"s2 1.0.3","title":"s2 1.0.3","text":"CRAN release: 2020-10-14 Fixed CRAN check errors (#80).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-102","dir":"Changelog","previous_headings":"","what":"s2 1.0.2","title":"s2 1.0.2","text":"CRAN release: 2020-08-03 Fixed CRAN check errors (#71, #75, #72).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-101","dir":"Changelog","previous_headings":"","what":"s2 1.0.1","title":"s2 1.0.1","text":"CRAN release: 2020-07-13 Added layer creation options s2_options(), now uses strings rather numeric codes specify boolean operation options, geography construction options, builder options (#70). Added s2_rebuild() s2_simplify(), wrap S2 C++ S2Builder class provide simplification fixing invalid geographies (#70). s2 package now builds passes CMD check Solaris (#66, #67). Renamed s2_latlng() s2_lnglat() keep axis order consistent throughout package (#69). Added s2_bounds_cap() s2_bounds_rect() compute bounding areas using geographic coordinates (@edzer, #63). s2_*_matrix() predicates now efficiently use indexing compute results many predicate comparisons (#61).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-100","dir":"Changelog","previous_headings":"","what":"s2 1.0.0","title":"s2 1.0.0","text":"CRAN release: 2020-06-27 version complete rewrite former s2 CRAN package, entirely backwards incompatible previous versions.","code":""}] +[{"path":"https://r-spatial.github.io/s2/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Dewey Dunnington. Author. Edzer Pebesma. Author, maintainer. Ege Rubak. Author. Jeroen Ooms. Contributor. configure script Google, Inc.. Copyright holder. Original s2geometry.io source code","code":""},{"path":"https://r-spatial.github.io/s2/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Dunnington D, Pebesma E, Rubak E (2024). s2: Spherical Geometry Operators Using S2 Geometry Library. R package version 1.1.7.9000, https://github.com/r-spatial/s2, http://s2geometry.io/, https://r-spatial.github.io/s2/.","code":"@Manual{, title = {s2: Spherical Geometry Operators Using the S2 Geometry Library}, author = {Dewey Dunnington and Edzer Pebesma and Ege Rubak}, year = {2024}, note = {R package version 1.1.7.9000, https://github.com/r-spatial/s2, http://s2geometry.io/}, url = {https://r-spatial.github.io/s2/}, }"},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"s2","dir":"","previous_headings":"","what":"Spherical Geometry Operators Using the S2 Geometry Library","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"s2 R package provides bindings Google’s S2Geometry library. package exposes API similar Google’s BigQuery Geography API, whose functions also operate spherical geometries. Package sf uses package default nearly geometrical operations objects ellipsoidal (unprojected) coordinates; cases doesn’t, st_relate(), emits warning. package complete rewrite earlier CRAN package s2 versions 0.4-2, sources found .","code":""},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"can install released version s2 CRAN : development version GitHub :","code":"install.packages(\"s2\") # install.packages(\"remotes\") remotes::install_github(\"r-spatial/s2\")"},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"s2 package provides geometry transformers predicates similar found GEOS, except instead assuming planar geometry, s2’s functions work latitude longitude assume spherical geometry: sf package uses s2 geographic coordinates sf::sf_use_s2(TRUE), become default sf version 1.0.0. sf package also supports creating s2 vectors using as_s2_geography(): Use accessors extract information geometries: Use predicates subset vectors: Use transformers create new geometries: Finally, use WKB WKT exporters export sf package:","code":"library(s2) s2_contains( # polygon containing much of the northern hemisphere \"POLYGON ((-63.5 44.6, -149.75 61.20, 116.4 40.2, 13.5 52.51, -63.5 44.6))\", # ...should contain the north pole \"POINT (0 90)\" ) #> [1] TRUE library(dplyr) library(sf) nc_s2 <- read_sf(system.file(\"shape/nc.shp\", package = \"sf\")) %>% mutate(geometry = as_s2_geography(geometry)) %>% as_tibble() %>% select(NAME, geometry) nc_s2 #> # A tibble: 100 × 2 #> NAME geometry #> #> 1 Ashe POLYGON ((-81.4528885 36.2395859, -81.4310379 36.2607193, -81.41… #> 2 Alleghany POLYGON ((-81.1766739 36.4154434, -81.1533661 36.4247398, -81.13… #> 3 Surry POLYGON ((-80.4530106 36.2570877, -80.4353104 36.5510445, -80.61… #> 4 Currituck MULTIPOLYGON (((-75.9419327 36.2943382, -75.9575119 36.2594528, … #> 5 Northampton POLYGON ((-77.1419601 36.4170647, -77.1393204 36.4564781, -77.12… #> 6 Hertford POLYGON ((-76.7074966 36.2661324, -76.7413483 36.3151665, -76.92… #> 7 Camden POLYGON ((-76.0173492 36.3377304, -76.0328751 36.3359756, -76.04… #> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.4522858, -76.4983… #> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 36.2135086, -78.05… #> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 36.5471344, -80.43… #> # … with 90 more rows nc_s2 %>% mutate( area = s2_area(geometry), perimeter = s2_perimeter(geometry) ) #> # A tibble: 100 × 4 #> NAME geometry area perimeter #> #> 1 Ashe POLYGON ((-81.4528885 36.2395859, -81.4310379 3… 1.14e9 141627. #> 2 Alleghany POLYGON ((-81.1766739 36.4154434, -81.1533661 3… 6.11e8 119876. #> 3 Surry POLYGON ((-80.4530106 36.2570877, -80.4353104 3… 1.42e9 160458. #> 4 Currituck MULTIPOLYGON (((-75.9419327 36.2943382, -75.957… 6.94e8 301644. #> 5 Northampton POLYGON ((-77.1419601 36.4170647, -77.1393204 3… 1.52e9 211794. #> 6 Hertford POLYGON ((-76.7074966 36.2661324, -76.7413483 3… 9.68e8 160780. #> 7 Camden POLYGON ((-76.0173492 36.3377304, -76.0328751 3… 6.16e8 150430. #> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.… 9.03e8 123170. #> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 3… 1.18e9 141073. #> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 3… 1.23e9 140583. #> # … with 90 more rows nc_s2 %>% filter(s2_contains(geometry, \"POINT (-80.9313 35.6196)\")) #> # A tibble: 1 × 2 #> NAME geometry #> #> 1 Catawba POLYGON ((-80.9312744 35.6195908, -81.0035782 35.6970558, -81.0547791… nc_s2 %>% mutate(geometry = s2_boundary(geometry)) #> # A tibble: 100 × 2 #> NAME geometry #> #> 1 Ashe LINESTRING (-81.4528885 36.2395859, -81.4310379 36.2607193, -81.… #> 2 Alleghany LINESTRING (-81.1766739 36.4154434, -81.1533661 36.4247398, -81.… #> 3 Surry LINESTRING (-80.4530106 36.2570877, -80.4353104 36.5510445, -80.… #> 4 Currituck MULTILINESTRING ((-75.9419327 36.2943382, -75.9575119 36.2594528… #> 5 Northampton LINESTRING (-77.1419601 36.4170647, -77.1393204 36.4564781, -77.… #> 6 Hertford LINESTRING (-76.7074966 36.2661324, -76.7413483 36.3151665, -76.… #> 7 Camden LINESTRING (-76.0173492 36.3377304, -76.0328751 36.3359756, -76.… #> 8 Gates LINESTRING (-76.46035 36.3738976, -76.5024643 36.4522858, -76.49… #> 9 Warren LINESTRING (-78.1347198 36.2365837, -78.1096268 36.2135086, -78.… #> 10 Stokes LINESTRING (-80.0240555 36.5450249, -80.0480957 36.5471344, -80.… #> # … with 90 more rows nc_s2 %>% mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>% st_as_sf() #> Simple feature collection with 100 features and 1 field #> Geometry type: GEOMETRY #> Dimension: XY #> Bounding box: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965 #> CRS: NA #> # A tibble: 100 × 2 #> NAME geometry #> #> 1 Ashe POLYGON ((-81.45289 36.23959, -81.43104 36.26072, -81.41233 36.2… #> 2 Alleghany POLYGON ((-81.17667 36.41544, -81.15337 36.42474, -81.1384 36.41… #> 3 Surry POLYGON ((-80.45301 36.25709, -80.43531 36.55104, -80.61105 36.5… #> 4 Currituck MULTIPOLYGON (((-75.94193 36.29434, -75.95751 36.25945, -75.9137… #> 5 Northampton POLYGON ((-77.14196 36.41706, -77.13932 36.45648, -77.12733 36.4… #> 6 Hertford POLYGON ((-76.7075 36.26613, -76.74135 36.31517, -76.92408 36.39… #> 7 Camden POLYGON ((-76.01735 36.33773, -76.03288 36.33598, -76.04395 36.3… #> 8 Gates POLYGON ((-76.46035 36.3739, -76.50246 36.45229, -76.49834 36.50… #> 9 Warren POLYGON ((-78.13472 36.23658, -78.10963 36.21351, -78.05835 36.2… #> 10 Stokes POLYGON ((-80.02406 36.54502, -80.0481 36.54713, -80.43531 36.55… #> # … with 90 more rows"},{"path":"https://r-spatial.github.io/s2/dev/index.html","id":"acknowledgment","dir":"","previous_headings":"","what":"Acknowledgment","title":"Spherical Geometry Operators Using the S2 Geometry Library","text":"project gratefully acknowledges financial support ","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an S2 Geography Vector — as_s2_geography","title":"Create an S2 Geography Vector — as_s2_geography","text":"Geography vectors arrays points, lines, polygons, /collections . Geography vectors assume coordinates longitude latitude perfect sphere.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an S2 Geography Vector — as_s2_geography","text":"","code":"as_s2_geography(x, ...) s2_geography() # S3 method for class 's2_geography' as_s2_geography(x, ...) # S3 method for class 'wk_xy' as_s2_geography(x, ...) # S3 method for class 'wk_wkb' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'WKB' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'blob' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'wk_wkt' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'character' as_s2_geography(x, ..., oriented = FALSE, check = TRUE) # S3 method for class 'logical' as_s2_geography(x, ...) # S3 method for class 's2_geography' as_wkb(x, ...) # S3 method for class 's2_geography' as_wkt(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an S2 Geography Vector — as_s2_geography","text":"x object can converted s2_geography vector ... Unused oriented TRUE polygon ring directions known correct (.e., exterior rings defined counter clockwise interior rings defined clockwise). check Use check = FALSE skip error invalid geometries","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an S2 Geography Vector — as_s2_geography","text":"object class s2_geography","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/as_s2_geography.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an S2 Geography Vector — as_s2_geography","text":"coercion function as_s2_geography() used wrap input functions s2 package can use objects unambiguious interpretation geography vector. Geography vectors minimal vctrs implementation, can use objects tibble, dplyr, packages use vctrs framework.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2-package.html","id":null,"dir":"Reference","previous_headings":"","what":"s2: Spherical Geometry Operators Using the S2 Geometry Library — s2-package","title":"s2: Spherical Geometry Operators Using the S2 Geometry Library — s2-package","text":"Provides R bindings Google's s2 library geometric calculations sphere. High-performance constructors exporters provide high compatibility existing spatial packages, transformers construct new geometries existing geometries, predicates provide means select geometries based spatial relationships, accessors extract information geometries.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"s2: Spherical Geometry Operators Using the S2 Geometry Library — s2-package","text":"Maintainer: Edzer Pebesma edzer.pebesma@uni-muenster.de (ORCID) Authors: Dewey Dunnington dewey@fishandwhistle.net (ORCID) Ege Rubak rubak@math.aau.dk contributors: Jeroen Ooms jeroen.ooms@stat.ucla.edu (configure script) [contributor] Google, Inc. (Original s2geometry.io source code) [copyright holder]","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 Geography Transformations — s2_boundary","title":"S2 Geography Transformations — s2_boundary","text":"functions operate one geography vectors return geography vector.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 Geography Transformations — s2_boundary","text":"","code":"s2_boundary(x) s2_centroid(x) s2_closest_point(x, y) s2_minimum_clearance_line_between(x, y) s2_difference(x, y, options = s2_options()) s2_sym_difference(x, y, options = s2_options()) s2_intersection(x, y, options = s2_options()) s2_union(x, y = NULL, options = s2_options()) s2_snap_to_grid(x, grid_size) s2_simplify(x, tolerance, radius = s2_earth_radius_meters()) s2_rebuild(x, options = s2_options()) s2_buffer_cells( x, distance, max_cells = 1000, min_level = -1, radius = s2_earth_radius_meters() ) s2_convex_hull(x) s2_centroid_agg(x, na.rm = FALSE) s2_coverage_union_agg(x, options = s2_options(), na.rm = FALSE) s2_rebuild_agg(x, options = s2_options(), na.rm = FALSE) s2_union_agg(x, options = s2_options(), na.rm = FALSE) s2_convex_hull_agg(x, na.rm = FALSE) s2_point_on_surface(x, na.rm = FALSE)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 Geography Transformations — s2_boundary","text":"x, y geography vectors. inputs passed as_s2_geography(), can pass objects (e.g., character vectors well-known text) directly. options s2_options() object describing polygon/polyline model use snap level. grid_size grid size coordinates snapped; rounded nearest power 10. tolerance minimum distance vertexes use simplifying geography. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters(). distance distance buffer, units radius. max_cells maximum number cells approximate buffer. min_level minimum cell level used approximate buffer (1 - 30). Setting value high result unnecessarily large geographies, may help improve buffers along long, narrow regions. na.rm aggregate calculations use na.rm = TRUE drop missing values.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"model","dir":"Reference","previous_headings":"","what":"Model","title":"S2 Geography Transformations — s2_boundary","text":"geometry model indicates whether geometry includes boundaries. Boundaries line geometries end points. OPEN geometries contain boundary (model = \"open\"); CLOSED geometries (model = \"closed\") contain boundary; SEMI-OPEN geometries (model = \"semi-open\") contain half boundaries, two polygons overlap two lines cross, point exist belong one geometries. (latter form, half-closed, present OpenGIS \"simple feature access\" (SFA) standard DE9-IM based). default values s2_contains() (open) covers/covered_by (closed) correspond SFA standard specification operators.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_boundary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"S2 Geography Transformations — s2_boundary","text":"","code":"# returns the boundary: # empty for point, endpoints of a linestring, # perimeter of a polygon s2_boundary(\"POINT (-64 45)\") #> #> [1] GEOMETRYCOLLECTION EMPTY s2_boundary(\"LINESTRING (0 0, 10 0)\") #> #> [1] MULTIPOINT ((0 0), (10 0)) s2_boundary(\"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\") #> #> [1] LINESTRING (0 0, 10 0, 10 10, 0 10, 0 0... # returns the area-weighted centroid, element-wise s2_centroid(\"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\") #> #> [1] POINT (5 5.00595863) s2_centroid(\"LINESTRING (0 0, 10 0)\") #> #> [1] POINT (5 0) # s2_point_on_surface guarantees a point on surface # Note: this is not the same as st_point_on_surface s2_centroid(\"POLYGON ((0 0, 10 0, 1 1, 0 10, 0 0))\") #> #> [1] POINT (2.00377112 2.00234355) s2_point_on_surface(\"POLYGON ((0 0, 10 0, 1 1, 0 10, 0 0))\") #> #> [1] POINT (0.450236802 0.450222902) # returns the unweighted centroid of the entire input s2_centroid_agg(c(\"POINT (0 0)\", \"POINT (10 0)\")) #> #> [1] POINT (5 0) # returns the closest point on x to y s2_closest_point( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POINT (0 90)\" # north pole! ) #> #> [1] POINT (5 10.037423) # returns the shortest possible line between x and y s2_minimum_clearance_line_between( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POINT (0 90)\" # north pole! ) #> #> [1] LINESTRING (5 10.037423, 0 90) # binary operations: difference, symmetric difference, intersection and union s2_difference( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] POLYGON ((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... s2_sym_difference( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] MULTIPOLYGON (((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... s2_intersection( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] POLYGON ((5.00000004 4.99999997, 10 5.01900178, 10 9.99999999, 5.00000004 10.0374231, 5.00000004 4.99999997... s2_union( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\", # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] POLYGON ((5.00000004 10.0374231, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 5.01900178... # s2_convex_hull_agg builds the convex hull of a list of geometries s2_convex_hull_agg( c( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\" ) ) #> #> [1] POLYGON ((0 0, 10 0, 15 5, 15 15, 5 15... # use s2_union_agg() to aggregate geographies in a vector s2_coverage_union_agg( c( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))\" ), # 32 bit platforms may need to set snap rounding s2_options(snap = s2_snap_level(30)) ) #> #> [1] MULTIPOLYGON (((3.55739019e-08 3.55739019e-08, 10 3.50334544e-08, 10 9.99999999, 3.55739019e-08 10, 3.55739019e-08 3.55739019e-08... # snap to grid rounds coordinates to a specified grid size s2_snap_to_grid(\"POINT (0.333333333333 0.666666666666)\", 1e-2) #> #> [1] POINT (0.33 0.67)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute feature-wise and aggregate bounds — s2_bounds_cap","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"s2_bounds_rect() returns bounding latitude-longitude rectangle contains region; s2_bounds_cap() returns bounding circle represented centre point (lat, lng) angle. bound may tight points, polylines geometry collections. rectangle returned may depend order points polylines. lng_lo values larger lng_hi indicate regions span antimeridian, see Fiji example.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"","code":"s2_bounds_cap(x) s2_bounds_rect(x)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"x s2_geography() vector.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"functions return data.frame: s2_bounds_rect(): Columns minlng, minlat, maxlng, maxlat (degrees) s2_bounds_cap(): Columns lng, lat, angle (degrees)","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_bounds_cap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute feature-wise and aggregate bounds — s2_bounds_cap","text":"","code":"s2_bounds_cap(s2_data_countries(\"Antarctica\")) #> lng lat angle #> 1 0 -90 26.72934 s2_bounds_cap(s2_data_countries(\"Netherlands\")) #> lng lat angle #> 1 5.203512 52.15706 1.792879 s2_bounds_cap(s2_data_countries(\"Fiji\")) #> lng lat angle #> 1 178.7459 -17.15444 1.801369 s2_bounds_rect(s2_data_countries(\"Antarctica\")) #> lng_lo lat_lo lng_hi lat_hi #> 1 -180 -90 180 -63.27066 s2_bounds_rect(s2_data_countries(\"Netherlands\")) #> lng_lo lat_lo lng_hi lat_hi #> 1 3.314971 50.80372 7.092053 53.5104 s2_bounds_rect(s2_data_countries(\"Fiji\")) #> lng_lo lat_lo lng_hi lat_hi #> 1 177.285 -18.28799 -179.7933 -16.02088"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":null,"dir":"Reference","previous_headings":"","what":"Create S2 Cell vectors — s2_cell","title":"Create S2 Cell vectors — s2_cell","text":"S2 cell indexing system forms basis spatial indexing S2 library. , S2 cells can represent points areas. union, vector S2 cells can approximate line polygon. functions allow direct access S2 cell indexing system designed minimal overhead looping recursion acceptable performance used within R code.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create S2 Cell vectors — s2_cell","text":"","code":"s2_cell(x = character()) s2_cell_sentinel() s2_cell_invalid() as_s2_cell(x, ...) # S3 method for class 's2_cell' as_s2_cell(x, ...) # S3 method for class 'character' as_s2_cell(x, ...) # S3 method for class 's2_geography' as_s2_cell(x, ...) # S3 method for class 'wk_xy' as_s2_cell(x, ...) # S3 method for class 'integer64' as_s2_cell(x, ...) new_s2_cell(x)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create S2 Cell vectors — s2_cell","text":"x canonical S2 cell identifier character vector. ... Passed methods","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create S2 Cell vectors — s2_cell","text":"object class s2_cell","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create S2 Cell vectors — s2_cell","text":"hood, S2 cell vectors represented R vectors type double(). works S2 cell identifiers 64 bits wide, doubles systems R runs (trick used bit64 package represent signed 64-bit integers). happy accident, NA_real_ valid meaningful cell identifier, missing value support way R users might expect preserved. worth noting underlying value s2_cell_sentinel() normally considered NA; however, meaningful useful programming S2 cells, custom .na() comparison methods implemented s2_cell_sentinel() greater valid S2 cells considered missing. Users can implement compiled code uses underlying bytes vector, ensuring class returned object interpreted way constructed new_s2_cell().","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create S2 Cell vectors — s2_cell","text":"","code":"s2_cell(\"4b59a0cd83b5de49\") #> #> [1] 4b59a0cd83b5de49 as_s2_cell(s2_lnglat(-64, 45)) #> #> [1] 4b59a0cd83b5de49 as_s2_cell(s2_data_cities(\"Ottawa\")) #> #> [1] 4cce045470cbd267"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_is_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 cell operators — s2_cell_is_valid","title":"S2 cell operators — s2_cell_is_valid","text":"S2 cell operators","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_is_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 cell operators — s2_cell_is_valid","text":"","code":"s2_cell_is_valid(x) s2_cell_debug_string(x) s2_cell_to_lnglat(x) s2_cell_center(x) s2_cell_boundary(x) s2_cell_polygon(x) s2_cell_vertex(x, k) s2_cell_level(x) s2_cell_is_leaf(x) s2_cell_is_face(x) s2_cell_area(x, radius = s2_earth_radius_meters()) s2_cell_area_approx(x, radius = s2_earth_radius_meters()) s2_cell_parent(x, level = -1L) s2_cell_child(x, k) s2_cell_edge_neighbour(x, k) s2_cell_contains(x, y) s2_cell_distance(x, y, radius = s2_earth_radius_meters()) s2_cell_max_distance(x, y, radius = s2_earth_radius_meters()) s2_cell_may_intersect(x, y) s2_cell_common_ancestor_level(x, y) s2_cell_common_ancestor_level_agg(x, na.rm = FALSE)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_is_valid.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 cell operators — s2_cell_is_valid","text":"x, y s2_cell() vector k integer 0 3 radius radius use (e.g., s2_earth_radius_meters()) level integer 0 30, inclusive. na.rm Remove NAs prior computing aggregate?","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":null,"dir":"Reference","previous_headings":"","what":"Create S2 Cell Union vectors — s2_cell_union","title":"Create S2 Cell Union vectors — s2_cell_union","text":"Create S2 Cell Union vectors","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create S2 Cell Union vectors — s2_cell_union","text":"","code":"s2_cell_union(x = list()) # S3 method for class 's2_cell_union' as_s2_geography(x, ...) as_s2_cell_union(x, ...) # S3 method for class 's2_cell_union' as_s2_cell_union(x, ...) # S3 method for class 's2_cell' as_s2_cell_union(x, ...) # S3 method for class 'character' as_s2_cell_union(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create S2 Cell Union vectors — s2_cell_union","text":"x list() s2_cell() vectors. ... Passed S3 methods","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create S2 Cell Union vectors — s2_cell_union","text":"object class \"s2_cell_union\".","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union_normalize.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 cell union operators — s2_cell_union_normalize","title":"S2 cell union operators — s2_cell_union_normalize","text":"S2 cell union operators","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union_normalize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 cell union operators — s2_cell_union_normalize","text":"","code":"s2_cell_union_normalize(x) s2_cell_union_contains(x, y) s2_cell_union_intersects(x, y) s2_cell_union_intersection(x, y) s2_cell_union_union(x, y) s2_cell_union_difference(x, y) s2_covering_cell_ids( x, min_level = 0, max_level = 30, max_cells = 8, buffer = 0, interior = FALSE, radius = s2_earth_radius_meters() ) s2_covering_cell_ids_agg( x, min_level = 0, max_level = 30, max_cells = 8, buffer = 0, interior = FALSE, radius = s2_earth_radius_meters(), na.rm = FALSE )"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_cell_union_normalize.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 cell union operators — s2_cell_union_normalize","text":"x, y s2_geography s2_cell_union(). min_level, max_level minimum maximum levels constrain covering. max_cells maximum number cells covering. Defaults 8. buffer distance buffer outside geography interior Use TRUE force covering inside geography. radius radius use (e.g., s2_earth_radius_meters()) na.rm Remove NAs prior computing aggregate?","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":null,"dir":"Reference","previous_headings":"","what":"Matrix Functions — s2_closest_feature","title":"Matrix Functions — s2_closest_feature","text":"functions similar accessors predicates, instead recycling x y common length returning vector length, functions return vector length x element containing information entire vector y relates feature x[].","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Matrix Functions — s2_closest_feature","text":"","code":"s2_closest_feature(x, y) s2_closest_edges( x, y, k, min_distance = -1, max_distance = Inf, radius = s2_earth_radius_meters() ) s2_farthest_feature(x, y) s2_distance_matrix(x, y, radius = s2_earth_radius_meters()) s2_max_distance_matrix(x, y, radius = s2_earth_radius_meters()) s2_contains_matrix(x, y, options = s2_options(model = \"open\")) s2_within_matrix(x, y, options = s2_options(model = \"open\")) s2_covers_matrix(x, y, options = s2_options(model = \"closed\")) s2_covered_by_matrix(x, y, options = s2_options(model = \"closed\")) s2_intersects_matrix(x, y, options = s2_options()) s2_disjoint_matrix(x, y, options = s2_options()) s2_equals_matrix(x, y, options = s2_options()) s2_touches_matrix(x, y, options = s2_options()) s2_dwithin_matrix(x, y, distance, radius = s2_earth_radius_meters()) s2_may_intersect_matrix(x, y, max_edges_per_cell = 50, max_feature_cells = 4)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Matrix Functions — s2_closest_feature","text":"x, y Geography vectors, coerced using as_s2_geography(). x considered source, y considered target. k number closest edges consider searching. Note S2 point also considered edge. min_distance minimum distance consider searching edges. filter applied search complete (.e., may cause fewer k values returned). max_distance maximum distance consider searching edges. filter applied search. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters(). options s2_options() object describing polygon/polyline model use snap level. distance distance surface earth units radius. max_edges_per_cell s2_may_intersect_matrix(), values controls nature index y, higher values leading coarser index. Values 10 50; default 50 adequate use cases, specialized operations users may wish use lower value increase performance. max_feature_cells s2_may_intersect_matrix(), value controls approximation x used identify potential intersections y. default value 4 gives best performance operations, specialized operations users may wish use higher value increase performance.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Matrix Functions — s2_closest_feature","text":"vector length x.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_closest_feature.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Matrix Functions — s2_closest_feature","text":"","code":"city_names <- c(\"Vatican City\", \"San Marino\", \"Luxembourg\") cities <- s2_data_cities(city_names) country_names <- s2_data_tbl_countries$name countries <- s2_data_countries() # closest feature returns y indices of the closest feature # for each feature in x country_names[s2_closest_feature(cities, countries)] #> [1] \"Italy\" \"Italy\" \"Luxembourg\" # farthest feature returns y indices of the farthest feature # for each feature in x country_names[s2_farthest_feature(cities, countries)] #> [1] \"New Zealand\" \"New Zealand\" \"New Zealand\" # use s2_closest_edges() to find the k-nearest neighbours nearest <- s2_closest_edges(cities, cities, k = 2, min_distance = 0) city_names #> [1] \"Vatican City\" \"San Marino\" \"Luxembourg\" city_names[unlist(nearest)] #> [1] \"San Marino\" \"Vatican City\" \"San Marino\" # predicate matrices country_names[s2_intersects_matrix(cities, countries)[[1]]] #> [1] \"Italy\" # distance matrices s2_distance_matrix(cities, cities) #> [,1] [,2] [,3] #> [1,] 0.0 226040.9 986762.6 #> [2,] 226040.9 0.0 792700.1 #> [3,] 986762.6 792700.1 0.0 s2_max_distance_matrix(cities, countries[1:4]) #> [,1] [,2] [,3] [,4] #> [1,] 5284474 6716222 729253.1 4488169 #> [2,] 5225941 6939199 798367.2 4551290 #> [3,] 5543951 7659266 1564998.8 5198533"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 Geography Predicates — s2_contains","title":"S2 Geography Predicates — s2_contains","text":"functions operate two geography vectors (pairwise), return logical vector.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 Geography Predicates — s2_contains","text":"","code":"s2_contains(x, y, options = s2_options(model = \"open\")) s2_within(x, y, options = s2_options(model = \"open\")) s2_covered_by(x, y, options = s2_options(model = \"closed\")) s2_covers(x, y, options = s2_options(model = \"closed\")) s2_disjoint(x, y, options = s2_options()) s2_intersects(x, y, options = s2_options()) s2_equals(x, y, options = s2_options()) s2_intersects_box( x, lng1, lat1, lng2, lat2, detail = 1000, options = s2_options() ) s2_touches(x, y, options = s2_options()) s2_dwithin(x, y, distance, radius = s2_earth_radius_meters()) s2_prepared_dwithin(x, y, distance, radius = s2_earth_radius_meters())"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 Geography Predicates — s2_contains","text":"x, y geography vectors. inputs passed as_s2_geography(), can pass objects (e.g., character vectors well-known text) directly. options s2_options() object describing polygon/polyline model use snap level. lng1, lat1, lng2, lat2 latitude/longitude range detail number points approximate non-geodesic edges. distance distance surface earth units radius. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters().","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"model","dir":"Reference","previous_headings":"","what":"Model","title":"S2 Geography Predicates — s2_contains","text":"geometry model indicates whether geometry includes boundaries. Boundaries line geometries end points. OPEN geometries contain boundary (model = \"open\"); CLOSED geometries (model = \"closed\") contain boundary; SEMI-OPEN geometries (model = \"semi-open\") contain half boundaries, two polygons overlap two lines cross, point exist belong one geometries. (latter form, half-closed, present OpenGIS \"simple feature access\" (SFA) standard DE9-IM based). default values s2_contains() (open) covers/covered_by (closed) correspond SFA standard specification operators.","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_contains.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"S2 Geography Predicates — s2_contains","text":"","code":"s2_contains( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_within( c(\"POINT (5 5)\", \"POINT (-1 1)\"), \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\" ) #> [1] TRUE FALSE s2_covered_by( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] FALSE FALSE s2_covers( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_disjoint( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] FALSE TRUE s2_intersects( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_equals( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", \"POLYGON ((10 0, 10 10, 0 10, 0 0, 10 0))\", \"POLYGON ((-1 -1, 10 0, 10 10, 0 10, -1 -1))\" ) ) #> [1] TRUE TRUE FALSE s2_intersects( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\") ) #> [1] TRUE FALSE s2_intersects_box( c(\"POINT (5 5)\", \"POINT (-1 1)\"), 0, 0, 10, 10 ) #> [1] TRUE FALSE s2_touches( \"POLYGON ((0 0, 0 1, 1 1, 0 0))\", c(\"POINT (0 0)\", \"POINT (0.5 0.75)\", \"POINT (0 0.5)\") ) #> [1] TRUE FALSE FALSE s2_dwithin( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\"), 0 # distance in meters ) #> [1] TRUE FALSE s2_dwithin( \"POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))\", c(\"POINT (5 5)\", \"POINT (-1 1)\"), 1e6 # distance in meters ) #> [1] TRUE TRUE"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_example_wkt.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Geometries — s2_data_example_wkt","title":"Example Geometries — s2_data_example_wkt","text":"geometries toy examples useful testing various coordinate shuffling operations s2 package.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_example_wkt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example Geometries — s2_data_example_wkt","text":"","code":"s2_data_example_wkt"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_example_wkt.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Example Geometries — s2_data_example_wkt","text":"object class list length 29.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":null,"dir":"Reference","previous_headings":"","what":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"Well-known binary versions Natural Earth low-resolution world boundaries timezone boundaries.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"","code":"s2_data_tbl_countries s2_data_tbl_timezones s2_data_tbl_cities s2_data_countries(name = NULL) s2_data_timezones(utc_offset_min = NULL, utc_offset_max = utc_offset_min) s2_data_cities(name = NULL)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"data.frame columns name (character), geometry (wk_wkb) object class data.frame 120 rows 2 columns. object class data.frame 243 rows 3 columns.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"Natural Earth Data","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"name name country, continent, city, NULL features. utc_offset_min, utc_offset_max Minimum /maximum timezone offsets.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_data_tbl_countries.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Low-resolution world boundaries, timezones, and cities — s2_data_tbl_countries","text":"","code":"head(s2_data_countries()) #> #> [1] POLYGON ((61.2108171 35.6500723, 60.8031934 34.4041019, 60.5284298 33.676446, 60.9637004 33.5288323, 60.5360779 32.9812688... #> [2] MULTIPOLYGON (((16.3265284 -5.8774704, 13.3755974 -5.8642412, 13.0248694 -5.9843889, 12.7351713 -5.9656821, 12.3224317 -6.1000925... #> [3] POLYGON ((20.5902474 41.8554042, 20.52295 42.21787, 20.2837545 42.3202595, 20.0707 42.58863, 19.8016134 42.5000935... #> [4] POLYGON ((51.5795187 24.2454971, 51.6177076 24.0142193, 52.0007333 23.0011545, 55.006803 22.4969475, 55.2083411 22.70833... #> [5] MULTIPOLYGON (((-65.5 -55.2, -65.05 -54.7, -66.45 -54.45, -67.75 -53.85, -68.25 -53.1... #> [6] POLYGON ((43.5827458 41.0921433, 43.7526579 40.7402009, 43.6564364 40.253564, 44.4000086 40.0050003, 44.7939897 39.7130026... s2_data_countries(\"Germany\") #> #> [1] POLYGON ((9.9219064 54.9831042, 9.2820488 54.8308654, 8.5262293 54.9627436, 8.572118 54.3956465, 8.8007345 54.0207856... s2_data_countries(\"Europe\") #> #> [1] POLYGON ((20.5902474 41.8554042, 20.52295 42.21787, 20.2837545 42.3202595, 20.0707 42.58863, 19.8016134 42.5000935... #> [2] POLYGON ((16.9796668 48.123497, 16.8799829 48.4700133, 16.9602881 48.5969823, 16.4992827 48.785808, 16.0296473 48.733899... #> [3] POLYGON ((3.3149711 51.345781, 2.513573 51.1485062, 2.6584221 50.796848, 3.1232516 50.7803633, 3.5881844 50.3789924... #> [4] POLYGON ((22.6571497 44.234923, 22.4104464 44.0080635, 22.5001567 43.6428144, 22.9860185 43.2111612, 22.6048015 42.8985188... #> [5] POLYGON ((19.0054863 44.8602337, 18.5532141 45.0815897, 17.8617835 45.0677404, 17.002146 45.2337768, 16.5349394 45.2116076... #> [6] POLYGON ((23.4841276 53.9124977, 23.5275358 53.4701216, 23.8049349 53.0897314, 23.7991988 52.6910994, 23.1994938 52.4869774... #> [7] POLYGON ((9.5942261 47.5250581, 8.5226119 47.8308275, 8.3173015 47.6135798, 7.4667591 47.620582, 7.1922022 47.4497655... #> [8] POLYGON ((16.9602881 48.5969823, 17.1019849 48.8169689, 17.545007 48.800019, 17.8864848 48.9034752, 17.9135116 48.9964928... #> [9] POLYGON ((9.9219064 54.9831042, 9.2820488 54.8308654, 8.5262293 54.9627436, 8.572118 54.3956465, 8.8007345 54.0207856... #> [10] MULTIPOLYGON (((12.6900061 55.609991, 12.3709042 56.1114074, 10.9039136 55.7799547, 11.0435433 55.3648638, 12.0899911 54.8000146... #> [11] POLYGON ((-9.0348177 41.8805706, -8.6719458 42.1346894, -8.263857 42.2804687, -8.0131746 41.7908861, -7.422513 41.7920747... #> [12] POLYGON ((24.3128626 57.7934236, 25.1645935 57.970157, 25.6028097 57.8475288, 26.4635323 57.4763887, 27.2881848 57.4745283... #> [13] POLYGON ((28.5919296 69.0647769, 29.015573 69.7664912, 27.7322921 70.164193, 26.179622 69.825299, 25.6892127 69.0921138... #> [14] MULTIPOLYGON (((-52.5564247 2.5047053, -52.2493375 3.2410945, -51.6577974 4.1562324, -51.8233429 4.5657681, -52.8821413 5.409851... #> [15] MULTIPOLYGON (((-5.6619486 54.5546032, -6.733847 55.17286, -7.5721679 55.1316222, -7.3660306 54.595841, -7.5721679 54.0599564... #> [16] MULTIPOLYGON (((23.6999801 35.7050044, 23.5149785 35.2799916, 24.7350074 35.0849905, 24.7249821 34.9199877, 26.1649976 35.0049954... #> [17] POLYGON ((18.8298381 45.9088777, 18.4560625 45.7594811, 17.6300664 45.9517691, 16.8825151 46.3806318, 16.5648084 46.5037509... #> [18] POLYGON ((16.2022982 46.852386, 16.370505 46.8413272, 16.5648084 46.5037509, 16.8825151 46.3806318, 17.6300664 45.9517691... #> [19] POLYGON ((-6.1978849 53.867565, -6.9537302 54.0737023, -7.5721679 54.0599564, -7.3660306 54.595841, -7.5721679 55.1316222... #> [20] POLYGON ((-14.5086954 66.4558922, -16.167819 66.5267923, -17.7986238 65.9938533, -19.0568416 66.2766009, -20.5762837 65.7321121... #> [21] MULTIPOLYGON (((15.520376 38.2311551, 14.7612492 38.1438736, 13.7411564 38.0349655, 12.5709436 38.1263811, 12.4310039 37.6129499... #> [22] POLYGON ((20.76216 42.05186, 21.3527 42.2068, 21.576636 42.2452244, 21.54332 42.32025, 21.66292 42.43922... #> [23] POLYGON ((22.7310987 54.3275369, 23.2439873 54.2205667, 23.4841276 53.9124977, 24.4506836 53.9057022, 25.5363538 54.2824234... #> [24] POLYGON ((6.0430734 50.1280517, 5.7824174 50.0903279, 5.674052 49.5294835, 5.8977592 49.4426671, 6.1863204 49.4638028... #> [25] POLYGON ((21.0558004 56.0310764, 22.2011569 56.3378018, 23.8782638 56.2736714, 24.8606844 56.3725284, 25.0009343 56.1645307... #> [26] POLYGON ((26.6193368 48.2207262, 26.9241761 48.1232645, 27.2338729 47.8267709, 27.5511662 47.4051171, 28.1280302 46.8104764... #> [27] POLYGON ((20.59023 41.85541, 20.46315 41.51509, 20.60518 41.08622, 21.0200403 40.842727, 21.6741606 40.9312745... #> [28] POLYGON ((19.8016134 42.5000935, 20.0707 42.58863, 20.25758 42.81275, 20.3398 42.89852, 19.95857 43.10604... #> [29] POLYGON ((6.0741826 53.5104033, 4.7059973 53.0917984, 3.8302885 51.6205445, 3.3149711 51.3457551, 4.0470712 51.2672586... #> [30] MULTIPOLYGON (((28.1655473 71.1854744, 26.3700497 70.9862617, 24.5465434 71.0304967, 23.0237423 70.2020718, 21.3784164 70.2551694... #> [31] POLYGON ((15.0169959 51.1066741, 15.4909721 50.7847299, 16.2386267 50.6977327, 16.1762533 50.4226073, 16.7194759 50.2157466... #> [32] POLYGON ((-9.0348177 41.8805706, -8.9907894 41.5434594, -8.7908532 41.184334, -8.768684 40.7606389, -8.9773535 40.1593061... #> [33] POLYGON ((22.7105314 47.8821939, 22.0997677 47.6724393, 21.6265149 46.9942378, 21.0219523 46.316088, 20.2201925 46.127469... #> [34] MULTIPOLYGON (((143.648007 50.7476004, 143.235268 51.7566603, 143.260848 52.7407604, 142.914615 53.7045775, 142.654786 54.3658808... #> [35] POLYGON ((20.8743128 45.4163754, 20.7621749 45.7345731, 20.2201925 46.127469, 19.5960445 46.1717298, 18.82982 45.90888... #> [36] POLYGON ((18.8531442 49.4962298, 18.5549711 49.4950154, 18.3999935 49.3150005, 18.1704985 49.2715148, 18.1049728 49.0439835... #> [37] POLYGON ((13.8064755 46.5093061, 13.69811 46.0167781, 13.9376302 45.5910159, 13.7150598 45.5003238, 14.4119682 45.4661657... #> [38] POLYGON ((22.1831735 65.7237405, 23.9033785 66.0069274, 23.5658798 66.3960509, 23.5394731 67.9360086, 21.9785348 68.6168456... #> [39] POLYGON ((31.7859982 52.101678, 30.9275493 52.0423534, 30.6194544 51.8228061, 30.5551172 51.3195035, 30.1573637 51.4161384... head(s2_data_timezones()) #> #> [1] POLYGON ((-142.530008 89.9, -157.52562 89.9, -157.525959 85.257726, -157.525963 80.615452, -157.525964 75.9731781... #> [2] POLYGON ((179.9 48.0498729, 179.9 53.7458252, 179.9 59.4417774, 177.269342 57.8252945, 174.9285 56.3300414... #> [3] POLYGON ((-157.52562 89.9, -172.509033 89.9, -172.508484 85.048013, -172.508478 80.1960259, -172.508476 75.3440389... #> [4] POLYGON ((-172.483 15.0205262, -172.500008 14.9990848, -172.501035 6.24488388, -172.502027 -2.50931703, -165.4943 -2.52823772... #> [5] POLYGON ((-179.9 34.9987943, -179.9 29.9990794, -178.046725 30.0025387, -178.046725 27.5915348, -176.346743 27.5914979... #> [6] POLYGON ((-167.997656 -5.84229697, -169.396078 -5.84229697, -170.992788 -9.42836242, -171.293786 -11.0572656, -171.003287 -13.9679213... s2_data_timezones(-4) #> #> [1] POLYGON ((-52.543144 89.9, -67.5030209 89.9, -67.5030209 83.1870838, -66.2483102 83.1525808, -65.3278911 83.1046193... #> [2] POLYGON ((-55.9540449 46.6167698, -56.1509228 46.5543787, -56.1515514 46.3058973, -56.4049242 46.3064124, -56.4050827 46.3676109... #> [3] POLYGON ((-67.4927669 -89.9, -52.5322527 -89.9, -52.5326913 -83.4592992, -52.5326947 -77.0185985, -61.1288044 -75.0218643... head(s2_data_cities()) #> #> [1] POINT (12.4533865 41.9032822) POINT (12.4417702 43.9360958) #> [3] POINT (9.51666947 47.1337238) POINT (31.1999971 -26.4666675) #> [5] POINT (6.13000281 49.6116604) POINT (158.149974 6.9166437) s2_data_cities(\"Cairo\") #> #> [1] POINT (31.2480224 30.0519062)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":null,"dir":"Reference","previous_headings":"","what":"Earth Constants — s2_earth_radius_meters","title":"Earth Constants — s2_earth_radius_meters","text":"According Yoder (1995), radius earth 6371.01 km. functions used set default radis functions return distance accept distance input (e.g., s2_distance() s2_dwithin()).","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Earth Constants — s2_earth_radius_meters","text":"","code":"s2_earth_radius_meters()"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Earth Constants — s2_earth_radius_meters","text":"Yoder, C.F. 1995. \"Astrometric Geodetic Properties Earth Solar System\" Global Earth Physics, Handbook Physical Constants, AGU Reference Shelf 1, American Geophysical Union, Table 2. doi:10.1029/RF001p0001","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_earth_radius_meters.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Earth Constants — s2_earth_radius_meters","text":"","code":"s2_earth_radius_meters() #> [1] 6371010"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":null,"dir":"Reference","previous_headings":"","what":"Create and Format Geography Vectors — s2_geog_point","title":"Create and Format Geography Vectors — s2_geog_point","text":"functions create export geography vectors. Unlike BigQuery geography constructors, functions sanitize invalid redundant input using s2_union(). Note creating polygons using s2_make_polygon(), rings can open closed.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create and Format Geography Vectors — s2_geog_point","text":"","code":"s2_geog_point(longitude, latitude) s2_make_line(longitude, latitude, feature_id = 1L) s2_make_polygon( longitude, latitude, feature_id = 1L, ring_id = 1L, oriented = FALSE, check = TRUE ) s2_geog_from_text( wkt_string, oriented = FALSE, check = TRUE, planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_geog_from_wkb( wkb_bytes, oriented = FALSE, check = TRUE, planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_as_text( x, precision = 16, trim = TRUE, planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_as_binary( x, endian = wk::wk_platform_endian(), planar = FALSE, tessellate_tol_m = s2_tessellate_tol_default() ) s2_tessellate_tol_default()"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create and Format Geography Vectors — s2_geog_point","text":"longitude, latitude Vectors latitude longitude feature_id, ring_id Vectors change sequential values indicates new feature ring. Use factor() convert character vector. oriented TRUE polygon ring directions known correct (.e., exterior rings defined counter clockwise interior rings defined clockwise). check Use check = FALSE skip error invalid geometries wkt_string Well-known text planar Use TRUE force planar edges import export. tessellate_tol_m maximum number meters point must moved satisfy planar edge constraint. wkb_bytes list() raw() x object can converted s2_geography vector precision number significant digits export writing well-known text. trim = FALSE, number digits decimal place. trim trailing zeroes included decimal place? endian endian-ness well-known binary. See wk::wkb_translate_wkb().","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_geog_point.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create and Format Geography Vectors — s2_geog_point","text":"","code":"# create point geographies using coordinate values: s2_geog_point(-64, 45) #> #> [1] POINT (-64 45) # create line geographies using coordinate values: s2_make_line(c(-64, 8), c(45, 71)) #> #> [1] LINESTRING (-64 45, 8 71) # optionally, separate features using feature_id: s2_make_line( c(-64, 8, -27, -27), c(45, 71, 0, 45), feature_id = c(1, 1, 2, 2) ) #> #> [1] LINESTRING (-64 45, 8 71) LINESTRING (-27 0, -27 45) # create polygon geographies using coordinate values: # (rings can be open or closed) s2_make_polygon(c(-45, 8, 0), c(64, 71, 90)) #> #> [1] POLYGON ((-45 64, 8 71, 0 90, -45 64)) # optionally, separate rings and/or features using # ring_id and/or feature_id s2_make_polygon( c(20, 10, 10, 30, 45, 30, 20, 20, 40, 20, 45), c(35, 30, 10, 5, 20, 20, 15, 25, 40, 45, 30), feature_id = c(rep(1, 8), rep(2, 3)), ring_id = c(1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1) ) #> #> [1] POLYGON ((20 35, 10 30, 10 10, 30 5, 45 20... #> [2] POLYGON ((40 40, 20 45, 45 30, 40 40)) # import and export well-known text (geog <- s2_geog_from_text(\"POINT (-64 45)\")) #> #> [1] POINT (-64 45) s2_as_text(geog) #> [1] \"POINT (-64 45)\" # import and export well-known binary (geog <- s2_geog_from_wkb(wk::as_wkb(\"POINT (-64 45)\"))) #> #> [1] POINT (-64 45) s2_as_binary(geog) #> [[1]] #> [1] 01 01 00 00 00 00 00 00 00 00 00 50 c0 00 00 00 00 00 80 46 40 #> #> attr(,\"class\") #> [1] \"blob\" # import geometry from planar space s2_geog_from_text( \"POLYGON ((0 0, 1 0, 0 1, 0 0))\", planar = TRUE, tessellate_tol_m = 1 ) #> #> [1] POLYGON ((0 0, 1 0, 0.5 0.5, 0.25 0.75, 0 1... # export geographies into planar space geog <- s2_make_polygon(c(179, -179, 179), c(10, 10, 11)) s2_as_text(geog, planar = TRUE) #> [1] \"POLYGON ((179 10, 180 10.00149252698408, 181 10, 180.0016175935936 10.50156386165192, 179 11, 179 10))\" # polygons containing a pole need an extra step geog <- s2_data_countries(\"Antarctica\") geom <- s2_as_text( s2_intersection(geog, s2_world_plate_carree()), planar = TRUE )"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":null,"dir":"Reference","previous_headings":"","what":"Linear referencing — s2_project","title":"Linear referencing — s2_project","text":"Linear referencing","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Linear referencing — s2_project","text":"","code":"s2_project(x, y, radius = s2_earth_radius_meters()) s2_project_normalized(x, y) s2_interpolate(x, distance, radius = s2_earth_radius_meters()) s2_interpolate_normalized(x, distance_normalized)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Linear referencing — s2_project","text":"x simple polyline geography vector y simple point geography vector. point snapped nearest point x purposes interpolation. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters(). distance distance along x radius units. distance_normalized distance normalized s2_length() x.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Linear referencing — s2_project","text":"s2_interpolate() returns point x, distance meters along line. s2_interpolate_normalized() returns point x interpolated fraction along line. s2_project() returns distance point occurs along x. s2_project_normalized() returns distance_normalized along x point occurs.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_interpolate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Linear referencing — s2_project","text":"","code":"s2_project_normalized(\"LINESTRING (0 0, 0 90)\", \"POINT (0 22.5)\") #> [1] 0.25 s2_project(\"LINESTRING (0 0, 0 90)\", \"POINT (0 22.5)\") #> [1] 2501890 s2_interpolate_normalized(\"LINESTRING (0 0, 0 90)\", 0.25) #> #> [1] POINT (0 22.5) s2_interpolate(\"LINESTRING (0 0, 0 90)\", 2501890) #> #> [1] POINT (0 22.500002)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":null,"dir":"Reference","previous_headings":"","what":"S2 Geography Accessors — s2_is_collection","title":"S2 Geography Accessors — s2_is_collection","text":"Accessors extract information geography vectors.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"S2 Geography Accessors — s2_is_collection","text":"","code":"s2_is_collection(x) s2_is_valid(x) s2_is_valid_detail(x) s2_dimension(x) s2_num_points(x) s2_is_empty(x) s2_area(x, radius = s2_earth_radius_meters()) s2_length(x, radius = s2_earth_radius_meters()) s2_perimeter(x, radius = s2_earth_radius_meters()) s2_x(x) s2_y(x) s2_distance(x, y, radius = s2_earth_radius_meters()) s2_max_distance(x, y, radius = s2_earth_radius_meters())"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"S2 Geography Accessors — s2_is_collection","text":"x, y geography vectors. inputs passed as_s2_geography(), can pass objects (e.g., character vectors well-known text) directly. radius Radius earth. Defaults average radius earth meters defined s2_earth_radius_meters().","code":""},{"path":[]},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_is_collection.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"S2 Geography Accessors — s2_is_collection","text":"","code":"# s2_is_collection() tests for multiple geometries in one feature s2_is_collection(c(\"POINT (-64 45)\", \"MULTIPOINT ((-64 45), (8 72))\")) #> [1] FALSE TRUE # s2_dimension() returns 0 for point, 1 for line, 2 for polygon s2_dimension( c( \"GEOMETRYCOLLECTION EMPTY\", \"POINT (-64 45)\", \"LINESTRING (-64 45, 8 72)\", \"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\", \"GEOMETRYCOLLECTION (POINT (-64 45), LINESTRING (-64 45, 8 72))\" ) ) #> [1] -1 0 1 2 1 # s2_num_points() counts points s2_num_points(c(\"POINT (-64 45)\", \"LINESTRING (-64 45, 8 72)\")) #> [1] 1 2 # s2_is_empty tests for emptiness s2_is_empty(c(\"POINT (-64 45)\", \"POINT EMPTY\")) #> [1] FALSE TRUE # calculate area, length, and perimeter s2_area(\"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\") #> [1] 1.233205e+12 s2_perimeter(\"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\") #> [1] 4430869 s2_length(s2_boundary(\"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\")) #> [1] 4430869 # extract x and y coordinates from points s2_x(c(\"POINT (-64 45)\", \"POINT EMPTY\")) #> [1] -64 NaN s2_y(c(\"POINT (-64 45)\", \"POINT EMPTY\")) #> [1] 45 NaN # calculate minimum and maximum distance between two geometries s2_distance( \"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\", \"POINT (-64 45)\" ) #> [1] 7189418 s2_max_distance( \"POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))\", \"POINT (-64 45)\" ) #> [1] 8757818"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an S2 LngLat Vector — s2_lnglat","title":"Create an S2 LngLat Vector — s2_lnglat","text":"class represents latitude longitude Earth's surface. calculations S2 convert as_s2_point(), unit vector representation value.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an S2 LngLat Vector — s2_lnglat","text":"","code":"s2_lnglat(lng, lat) as_s2_lnglat(x, ...) # Default S3 method as_s2_lnglat(x, ...) # S3 method for class 'wk_xy' as_s2_lnglat(x, ...) # S3 method for class 'wk_xyz' as_s2_lnglat(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an S2 LngLat Vector — s2_lnglat","text":"lat, lng Vectors latitude longitude values degrees. x s2_lnglat() vector object can coerced one. ... Unused","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an S2 LngLat Vector — s2_lnglat","text":"object class s2_lnglat","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_lnglat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an S2 LngLat Vector — s2_lnglat","text":"","code":"s2_lnglat(45, -64) # Halifax, Nova Scotia! #> #> [1] (45 -64) as.data.frame(s2_lnglat(45, -64)) #> x y #> 1 45 -64"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Geography Operation Options — s2_options","title":"Geography Operation Options — s2_options","text":"functions specify defaults options used perform operations construct geometries. used predicates (e.g., s2_intersects()), boolean operations (e.g., s2_intersection()) specify model containment new geometries constructed.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Geography Operation Options — s2_options","text":"","code":"s2_options( model = NULL, snap = s2_snap_identity(), snap_radius = -1, duplicate_edges = FALSE, edge_type = \"directed\", validate = FALSE, polyline_type = \"path\", polyline_sibling_pairs = \"keep\", simplify_edge_chains = FALSE, split_crossing_edges = FALSE, idempotent = FALSE, dimensions = c(\"point\", \"polyline\", \"polygon\") ) s2_snap_identity() s2_snap_level(level) s2_snap_precision(precision) s2_snap_distance(distance)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Geography Operation Options — s2_options","text":"model One 'open', 'semi-open' (default polygons), 'closed' (default polylines). See section 'Model' snap Use s2_snap_identity(), s2_snap_distance(), s2_snap_level(), s2_snap_precision() specify coordinate rounding occur. snap_radius opposed snap function, specifies maximum distance vertex move, snap radius (radians) sets minimum distance vertices output cause vertices move distance specified snap function. can used simplify result boolean operation. Use -1 specify minimum distance acceptable. duplicate_edges Use TRUE keep duplicate edges (e.g., duplicate points). edge_type One 'directed' (default) 'undirected'. validate Use TRUE validate result builder. polyline_type One 'path' (default) 'walk'. 'walk', polylines backtrack preserved. polyline_sibling_pairs One 'discard' (default) 'keep'. simplify_edge_chains Use TRUE remove vertices within snap_radius original vertex. split_crossing_edges Use TRUE split crossing polyline edges creating geometries. idempotent Use FALSE apply snap even snapping necessary satisfy vertex constraints. dimensions combination 'point', 'polyline', /'polygon' can used constrain output s2_rebuild() boolean operation. level value 0 30 corresponding cell level snapping occur. precision number coordinates multiplied rounded. Rounded nearest exponent 10. distance distance (radians) denoting maximum distance vertex move snapping process.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"model","dir":"Reference","previous_headings":"","what":"Model","title":"Geography Operation Options — s2_options","text":"geometry model indicates whether geometry includes boundaries. Boundaries line geometries end points. OPEN geometries contain boundary (model = \"open\"); CLOSED geometries (model = \"closed\") contain boundary; SEMI-OPEN geometries (model = \"semi-open\") contain half boundaries, two polygons overlap two lines cross, point exist belong one geometries. (latter form, half-closed, present OpenGIS \"simple feature access\" (SFA) standard DE9-IM based). default values s2_contains() (open) covers/covered_by (closed) correspond SFA standard specification operators.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Geography Operation Options — s2_options","text":"","code":"# use s2_options() to specify containment models, snap level # layer creation options, and builder options s2_options(model = \"closed\", snap = s2_snap_level(30)) #> $model #> [1] 3 #> #> $snap #> $level #> [1] 30 #> #> attr(,\"class\") #> [1] \"snap_level\" #> #> $snap_radius #> [1] -1 #> #> $duplicate_edges #> [1] FALSE #> #> $edge_type #> [1] 1 #> #> $validate #> [1] FALSE #> #> $polyline_type #> [1] 1 #> #> $polyline_sibling_pairs #> [1] 2 #> #> $simplify_edge_chains #> [1] FALSE #> #> $split_crossing_edges #> [1] FALSE #> #> $idempotent #> [1] FALSE #> #> $dimensions #> [1] 1 2 3 #> #> attr(,\"class\") #> [1] \"s2_options\""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot S2 Geographies — s2_plot","title":"Plot S2 Geographies — s2_plot","text":"Plot S2 Geographies","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot S2 Geographies — s2_plot","text":"","code":"s2_plot( x, ..., asp = 1, xlab = \"\", ylab = \"\", rule = \"evenodd\", add = FALSE, plot_hemisphere = FALSE, simplify = TRUE, centre = NULL )"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot S2 Geographies — s2_plot","text":"x wkb() wkt() ... Passed plotting functions features: graphics::points() point multipoint geometries, graphics::lines() linestring multilinestring geometries, graphics::polypath() polygon multipolygon geometries. asp, xlab, ylab Passed graphics::plot() rule rule use filling polygons (see graphics::polypath()) add new plot created, handleable added existing plot? plot_hemisphere Plot outline earth simplify Use FALSE skip simplification step centre longitude/latitude point centre orthographic projection","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot S2 Geographies — s2_plot","text":"input, invisibly","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot S2 Geographies — s2_plot","text":"","code":"s2_plot(s2_data_countries()) s2_plot(s2_data_cities(), add = TRUE)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an S2 Point Vector — s2_point","title":"Create an S2 Point Vector — s2_point","text":"S2 terminology, \"point\" 3-dimensional unit vector representation s2_point(). Internally, s2 objects stored 3-dimensional unit vectors.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an S2 Point Vector — s2_point","text":"","code":"s2_point(x, y, z) s2_point_crs() as_s2_point(x, ...) # Default S3 method as_s2_point(x, ...) # S3 method for class 'wk_xy' as_s2_point(x, ...) # S3 method for class 'wk_xyz' as_s2_point(x, ...)"},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an S2 Point Vector — s2_point","text":"x, y, z Vectors latitude longitude values degrees. ... Unused","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an S2 Point Vector — s2_point","text":"object class s2_point","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/s2_point.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an S2 Point Vector — s2_point","text":"","code":"point <- s2_lnglat(-64, 45) # Halifax, Nova Scotia! as_s2_point(point) #> #> [1] Z (0.3099752 -0.6355434 0.7071068) as.data.frame(as_s2_point(point)) #> x y z #> 1 0.3099752 -0.6355434 0.7071068"},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":null,"dir":"Reference","previous_headings":"","what":"Low-level wk filters and handlers — wk_handle.s2_geography","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"Low-level wk filters handlers","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"","code":"# S3 method for class 's2_geography' wk_handle( handleable, handler, ..., s2_projection = s2_projection_plate_carree(), s2_tessellate_tol = Inf ) s2_geography_writer( oriented = FALSE, check = TRUE, projection = s2_projection_plate_carree(), tessellate_tol = Inf ) # S3 method for class 's2_geography' wk_writer(handleable, ...) s2_trans_point() s2_trans_lnglat() s2_projection_plate_carree(x_scale = 180) s2_projection_mercator(x_scale = 20037508.3427892) s2_hemisphere(centre) s2_world_plate_carree(epsilon_east_west = 0, epsilon_north_south = 0) s2_projection_orthographic(centre = s2_lnglat(0, 0))"},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"handleable geometry vector (e.g., wkb(), wkt(), xy(), rct(), sf::st_sfc()) wk_handle() defined. handler wk_handler object. ... Passed wk_handle() method. oriented TRUE polygon ring directions known correct (.e., exterior rings defined counter clockwise interior rings defined clockwise). check Use check = FALSE skip error invalid geometries projection, s2_projection One s2_projection_plate_carree() s2_projection_mercator() tessellate_tol, s2_tessellate_tol angle radians. Points added line segment within distance point. x_scale maximum x value projection centre center point orthographic projection epsilon_east_west, epsilon_north_south Use positive number define edges Cartesian world slightly inward -180, -90, 180, 90. may used define world outline projection projecting extreme edges earth results non-finite value.","code":""},{"path":"https://r-spatial.github.io/s2/dev/reference/wk_handle.s2_geography.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Low-level wk filters and handlers — wk_handle.s2_geography","text":"s2_projection_plate_carree(), s2_projection_mercator(): external pointer S2 projection.","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-development-version","dir":"Changelog","previous_headings":"","what":"s2 (development version)","title":"s2 (development version)","text":"Abseil dependency resolved using pkg-config possible. possible, vendored version Abseil built using CMake (#258).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-116","dir":"Changelog","previous_headings":"","what":"s2 1.1.6","title":"s2 1.1.6","text":"CRAN release: 2023-12-19 Fix CRAN warning (#254).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-115","dir":"Changelog","previous_headings":"","what":"s2 1.1.5","title":"s2 1.1.5","text":"CRAN release: 2023-12-10 fix compiler problem Alpine 3.19.0 (#251)","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-114","dir":"Changelog","previous_headings":"","what":"s2 1.1.4","title":"s2 1.1.4","text":"CRAN release: 2023-05-17 Updated tests pass forthcoming waldo package update (#237).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-113","dir":"Changelog","previous_headings":"","what":"s2 1.1.3","title":"s2 1.1.3","text":"CRAN release: 2023-04-27 Made test less strict pass tests Alpine Linux (#218, #220). Updated tests pass forthcoming waldo package update (@hadley, #226). Updated vendored file modifications suppress multi-line comment warning gcc (#214, #227).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-112","dir":"Changelog","previous_headings":"","what":"s2 1.1.2","title":"s2 1.1.2","text":"CRAN release: 2023-01-12 Fixed test .data.frame() s2_cell() comply new wk version latest release R (#207). Fix unary union empty multipolygon (#208). Added #include Abseil header fix compilation gcc13 (#209, #210). Update internal Abseil 20220623.1 LTS (#213).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-111","dir":"Changelog","previous_headings":"","what":"s2 1.1.1","title":"s2 1.1.1","text":"CRAN release: 2022-11-17 Fix new CRAN check warnings (#202, #203).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-110","dir":"Changelog","previous_headings":"","what":"s2 1.1.0","title":"s2 1.1.0","text":"CRAN release: 2022-07-18 Fix s2 build Windows R <= 3.6.x (#142) Fix s2 build MacOS multiple openssl versions (#142, #145, #146) Fix s2 build 32-bit openssl (#143, #147) Added s2_convex_hull() s2_convex_hull_agg() (@spiry34, #150, #151, #163). Added max_distance argument s2_closest_edges(), making distance-constrained k-nearest neighbours possible (#125, #156, #162). Added spherical s2_point_on_surface() implementation polygons (@kylebutts, #152, #161) Added s2_cell_union() vector class represent cell coverings operators generate s2 geography vector (e.g., s2_covering_cell_ids()). Cell unions useful compact representations spherical geometry can used like bounding box determine possible intersection one geographies (#85, #94, #164). Refactored simple features compatability layer standalone code base potential future use Python adaptation (#165). Migrate input output non-deprecated wk package handlers writers (#101, #165, #168). Make s2_union_agg() efficient using recursive merge strategy (#103, #165). Fix package build Raspberry Pi (#169, #171). Fix warning clang14 compiling -O0 (#167, #172). Added s2_prepared_dwithin() fixed s2_dwithin_matrix() efficiently uses index (#157, #174). Updated s2_lnglat() s2_point() use wk::xy() (record-style vctr) represent point coordinates. much faster previous representation relied list() external pointers (#181, #159). Added arguments planar tessellate_tol_m s2_as_text(), s2_as_binary(). Use planar = TRUE set tessellate_tol_m maximum error use-case automatically subdivide edges preserve “straight” lines Plate carree projection import (#182). Added arguments planar tessellate_tol_m s2_geog_from_text(), s2_geog_from_wkb(). Use planar = TRUE set tessellate_tol_m maximum error use-case automatically subdivide edges ensure “straight” lines Plate carree projection export (#182).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-107","dir":"Changelog","previous_headings":"","what":"s2 1.0.7","title":"s2 1.0.7","text":"CRAN release: 2021-09-28 Update internal copy s2geometry use updated Abseil, fixing compiler warning gcc-11 (#79, #134).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-106","dir":"Changelog","previous_headings":"","what":"s2 1.0.6","title":"s2 1.0.6","text":"CRAN release: 2021-06-17 Added support STRICT_R_HEADERS (@eddelbuettel, #118). Fixed bug result s2_centroid_agg() behave like normal point distance calculations (#119, #121). Fixed Windows UCRT check failure updated openssl linking (@jeroen, #122).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-105","dir":"Changelog","previous_headings":"","what":"s2 1.0.5","title":"s2 1.0.5","text":"CRAN release: 2021-06-01 Added s2_projection_filter() s2_unprojection_filter() expose S2 edge tessellator, can used make Cartesian great circle assumptions line segments explicit adding points necessary (#115). Added s2_cell() vector class expose subset S2 indexing system R users (#85, #114). Added s2_closest_edges() make k-nearest neighbours calculation possible sphere (#111, #112). Added s2_interpolate(), s2_interpolate_normalized(), s2_project(), s2_project_normalized() provide linear referencing support sphere (#96, #110). Fixed import empty points WKB (#109). Added argument dimensions s2_options() constrain output dimensions boolean rebuild operation (#105, #104, #110). Added s2_is_valid() s2_is_valid_detail() help find invalid spherical geometries importing data S2 (#100). Improved error messages importing processing data errors can debugged readily (#100, #98). unary version s2_union() can now handle MULTIPOLYGON geometries overlapping rings addition invalid polygons. s2_union() can now sanitize almost input valid spherical geometry minimal modification (#100, #99). Renamed existing implementation s2_union_agg() s2_coverage_union_agg() make clear function works individual geometries overlapping interiors. s2_union_agg() replaced true aggregate union can handle unions geometries (#100, #97). Added s2_rebuild_agg() match s2_union_agg(). Like s2_rebuild(), s2_rebuild_agg() collects edges input builds feature, optionally snapping simplifying vertices process (#100).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-104","dir":"Changelog","previous_headings":"","what":"s2 1.0.4","title":"s2 1.0.4","text":"CRAN release: 2021-01-05 Fixed errors resulted compilation clang 12.2 (#88, #89).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-103","dir":"Changelog","previous_headings":"","what":"s2 1.0.3","title":"s2 1.0.3","text":"CRAN release: 2020-10-14 Fixed CRAN check errors (#80).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-102","dir":"Changelog","previous_headings":"","what":"s2 1.0.2","title":"s2 1.0.2","text":"CRAN release: 2020-08-03 Fixed CRAN check errors (#71, #75, #72).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-101","dir":"Changelog","previous_headings":"","what":"s2 1.0.1","title":"s2 1.0.1","text":"CRAN release: 2020-07-13 Added layer creation options s2_options(), now uses strings rather numeric codes specify boolean operation options, geography construction options, builder options (#70). Added s2_rebuild() s2_simplify(), wrap S2 C++ S2Builder class provide simplification fixing invalid geographies (#70). s2 package now builds passes CMD check Solaris (#66, #67). Renamed s2_latlng() s2_lnglat() keep axis order consistent throughout package (#69). Added s2_bounds_cap() s2_bounds_rect() compute bounding areas using geographic coordinates (@edzer, #63). s2_*_matrix() predicates now efficiently use indexing compute results many predicate comparisons (#61).","code":""},{"path":"https://r-spatial.github.io/s2/dev/news/index.html","id":"s2-100","dir":"Changelog","previous_headings":"","what":"s2 1.0.0","title":"s2 1.0.0","text":"CRAN release: 2020-06-27 version complete rewrite former s2 CRAN package, entirely backwards incompatible previous versions.","code":""}]