Skip to content

Commit 6db914a

Browse files
committed
devtools::build_readme()
1 parent 5b461b8 commit 6db914a

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

README.md

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
---
2-
output: github_document
3-
---
41

52
<!-- README.md is generated from README.Rmd. Please edit that file -->
63

7-
8-
94
# s2
105

116
<!-- badges: start -->
7+
128
![R-CMD-check](https://github.com/r-spatial/s2/workflows/R-CMD-check/badge.svg)
139
[![codecov](https://codecov.io/gh/r-spatial/s2/branch/master/graph/badge.svg)](https://codecov.io/gh/r-spatial/s2)
1410
[![CRAN](http://www.r-pkg.org/badges/version/s2)](https://cran.r-project.org/package=s2)
1511
[![Downloads](http://cranlogs.r-pkg.org/badges/s2?color=brightgreen)](http://www.r-pkg.org/pkg/s2)
1612
<!-- badges: end -->
1713

18-
The s2 R package provides bindings to Google's [S2Geometry](https://s2geometry.io) library. The package exposes an API similar to Google's [BigQuery Geography API](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions), whose functions also operate on spherical geometries. Package [sf](https://cran.r-project.org/web/packages/sf/index.html) uses this package by default for nearly all its geometrical operations on objects with ellipsoidal (unprojected) coordinates; in cases where it doesn't, such as `st_relate()`, it emits a warning.
14+
The s2 R package provides bindings to Google’s
15+
[S2Geometry](https://s2geometry.io) library. The package exposes an API
16+
similar to Google’s [BigQuery Geography
17+
API](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions),
18+
whose functions also operate on spherical geometries. Package
19+
[sf](https://cran.r-project.org/web/packages/sf/index.html) uses this
20+
package by default for nearly all its geometrical operations on objects
21+
with ellipsoidal (unprojected) coordinates; in cases where it doesn’t,
22+
such as `st_relate()`, it emits a warning.
1923

20-
This package is a complete rewrite of an earlier CRAN package s2 with versions up
21-
to 0.4-2, for which the sources are found [here](https://github.com/spatstat/s2/).
24+
This package is a complete rewrite of an earlier CRAN package s2 with
25+
versions up to 0.4-2, for which the sources are found
26+
[here](https://github.com/spatstat/s2/).
2227

2328
## Installation
2429

25-
You can install the released version of s2 from [CRAN](https://CRAN.R-project.org) with:
30+
You can install the released version of s2 from
31+
[CRAN](https://CRAN.R-project.org) with:
2632

2733
``` r
2834
install.packages("s2")
@@ -37,10 +43,12 @@ remotes::install_github("r-spatial/s2")
3743

3844
## Example
3945

40-
The s2 package provides geometry transformers and predicates similar to those found in [GEOS](https://trac.osgeo.org/geos/), except instead of assuming a planar geometry, s2's functions work in latitude and longitude and assume a spherical geometry:
41-
46+
The s2 package provides geometry transformers and predicates similar to
47+
those found in [GEOS](https://trac.osgeo.org/geos/), except instead of
48+
assuming a planar geometry, s2’s functions work in latitude and
49+
longitude and assume a spherical geometry:
4250

43-
```r
51+
``` r
4452
library(s2)
4553

4654
s2_contains(
@@ -52,10 +60,12 @@ s2_contains(
5260
#> [1] TRUE
5361
```
5462

55-
The [sf package](https://r-spatial.github.io/sf/) uses s2 for geographic coordinates with `sf::sf_use_s2(TRUE)`, and will become the default after sf version 1.0.0. The sf package also supports creating s2 vectors using `as_s2_geography()`:
56-
63+
The [sf package](https://r-spatial.github.io/sf/) uses s2 for geographic
64+
coordinates with `sf::sf_use_s2(TRUE)`, and will become the default
65+
after sf version 1.0.0. The sf package also supports creating s2 vectors
66+
using `as_s2_geography()`:
5767

58-
```r
68+
``` r
5969
library(dplyr)
6070
library(sf)
6171

@@ -83,8 +93,7 @@ nc_s2
8393

8494
Use accessors to extract information about geometries:
8595

86-
87-
```r
96+
``` r
8897
nc_s2 %>%
8998
mutate(
9099
area = s2_area(geometry),
@@ -108,8 +117,7 @@ nc_s2 %>%
108117

109118
Use predicates to subset vectors:
110119

111-
112-
```r
120+
``` r
113121
nc_s2 %>%
114122
filter(s2_contains(geometry, "POINT (-80.9313 35.6196)"))
115123
#> # A tibble: 1 x 2
@@ -120,8 +128,7 @@ nc_s2 %>%
120128

121129
Use transformers to create new geometries:
122130

123-
124-
```r
131+
``` r
125132
nc_s2 %>%
126133
mutate(geometry = s2_boundary(geometry))
127134
#> # A tibble: 100 x 2
@@ -140,10 +147,10 @@ nc_s2 %>%
140147
#> # … with 90 more rows
141148
```
142149

143-
Finally, use the WKB or WKT exporters to export to sf or some other package:
144-
150+
Finally, use the WKB or WKT exporters to export to sf or some other
151+
package:
145152

146-
```r
153+
``` r
147154
nc_s2 %>%
148155
mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>%
149156
st_as_sf()
@@ -170,8 +177,8 @@ nc_s2 %>%
170177

171178
## Acknowledgment
172179

173-
This project gratefully acknowledges financial [support](https://www.r-consortium.org/projects) from the
180+
This project gratefully acknowledges financial
181+
[support](https://www.r-consortium.org/projects) from the
174182

175183
<a href="https://www.r-consortium.org/projects/awarded-projects">
176-
<img src="man/figures/rc300.png" width="300" />
177-
</a>
184+
<img src="man/figures/rc300.png" width="300" /> </a>

0 commit comments

Comments
 (0)