Skip to content

Commit 92d48bd

Browse files
authored
Merge pull request #91 from r-spatial/dewey-dev
Release checks
2 parents 8aa1785 + 3a24fa1 commit 92d48bd

File tree

5 files changed

+45
-43
lines changed

5 files changed

+45
-43
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: s2
22
Title: Spherical Geometry Operators Using the S2 Geometry Library
3-
Version: 1.0.3.9000
3+
Version: 1.0.4
44
Authors@R: c(
55
person(given = "Dewey",
66
family = "Dunnington",

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# s2 (development version)
1+
# s2 1.0.4
2+
3+
* Fixed errors that resulted from compilation on clang 12.2 (#88, #89).
24

35
# s2 1.0.3
46

README.Rmd

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ knitr::opts_chunk$set(
2222
[![CRAN](http://www.r-pkg.org/badges/version/s2)](https://cran.r-project.org/package=s2)
2323
<!-- badges: end -->
2424

25-
The goal of s2 is to provide R 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.
26-
This package is a complete rewrite of an earlier CRAN package s2 with versions up
25+
The goal of s2 is to provide R 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. This package is a complete rewrite of an earlier CRAN package s2 with versions up
2726
to 0.4-2, for which the sources are found [here](https://github.com/spatstat/s2/).
2827

2928
## Installation
@@ -56,14 +55,14 @@ s2_contains(
5655
)
5756
```
5857

59-
The [sf package](https://r-spatial.github.io/sf/) will soon support s2 natively, but s2 can also read well-known text and well-known binary:
58+
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()`:
6059

6160
```{r, warning=FALSE, message = FALSE}
6261
library(dplyr)
6362
library(sf)
6463
6564
nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>%
66-
mutate(geometry = s2_geog_from_wkb(st_as_binary(geometry))) %>%
65+
mutate(geometry = as_s2_geography(geometry)) %>%
6766
as_tibble() %>%
6867
select(NAME, geometry)
6968
@@ -107,5 +106,5 @@ nc_s2 %>%
107106
This project gratefully acknowledges financial [support](https://www.r-consortium.org/projects) from the
108107

109108
<a href="https://www.r-consortium.org/projects/awarded-projects">
110-
<img src="http://pebesma.staff.ifgi.de/RConsortium_Horizontal_Pantone.png" width="300">
109+
<img src="man/figures/rc300.png" width="300" />
111110
</a>

README.md

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -56,32 +56,34 @@ s2_contains(
5656
#> [1] TRUE
5757
```
5858

59-
The [sf package](https://r-spatial.github.io/sf/) will soon support s2
60-
natively, but s2 can also read well-known text and well-known binary:
59+
The [sf package](https://r-spatial.github.io/sf/) uses s2 for geographic
60+
coordinates with `sf::sf_use_s2(TRUE)`, and will become the default
61+
after sf version 1.0.0. The sf package also supports creating s2 vectors
62+
using `as_s2_geography()`:
6163

6264
``` r
6365
library(dplyr)
6466
library(sf)
6567

6668
nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>%
67-
mutate(geometry = s2_geog_from_wkb(st_as_binary(geometry))) %>%
69+
mutate(geometry = as_s2_geography(geometry)) %>%
6870
as_tibble() %>%
6971
select(NAME, geometry)
7072

7173
nc_s2
7274
#> # A tibble: 100 x 2
7375
#> NAME geometry
7476
#> <chr> <s2_geography>
75-
#> 1 Ashe <POLYGON ((-81.4529 36.2396, -81.431 36.2607, -81.4123 36.2673,
76-
#> 2 Alleghany <POLYGON ((-81.1767 36.4154, -81.1534 36.4247, -81.1384 36.4176,
77-
#> 3 Surry <POLYGON ((-80.453 36.2571, -80.4353 36.551, -80.6111 36.5573, -
78-
#> 4 Currituck <MULTIPOLYGON (((-75.9419 36.2943, -75.9575 36.2595, -75.9138 36
79-
#> 5 Northampton <POLYGON ((-77.142 36.4171, -77.1393 36.4565, -77.1273 36.4707,
80-
#> 6 Hertford <POLYGON ((-76.7075 36.2661, -76.7413 36.3152, -76.9241 36.3924,
81-
#> 7 Camden <POLYGON ((-76.0173 36.3377, -76.0329 36.336, -76.044 36.3536, -
82-
#> 8 Gates <POLYGON ((-76.4604 36.3739, -76.5025 36.4523, -76.4983 36.5039,
83-
#> 9 Warren <POLYGON ((-78.1347 36.2366, -78.1096 36.2135, -78.0583 36.2113,
84-
#> 10 Stokes <POLYGON ((-80.0241 36.545, -80.0481 36.5471, -80.4353 36.551, -
77+
#> 1 Ashe <POLYGON ((-81.4528885 36.2395859, -81.4310379 36.2607193, -81.4
78+
#> 2 Alleghany <POLYGON ((-81.1766739 36.4154434, -81.1533661 36.4247398, -81.1
79+
#> 3 Surry <POLYGON ((-80.4530106 36.2570877, -80.4353104 36.5510445, -80.6
80+
#> 4 Currituck <MULTIPOLYGON (((-75.9419327 36.2943382, -75.9575119 36.2594528,
81+
#> 5 Northampton <POLYGON ((-77.1419601 36.4170647, -77.1393204 36.4564781, -77.1
82+
#> 6 Hertford <POLYGON ((-76.7074966 36.2661324, -76.7413483 36.3151665, -76.9
83+
#> 7 Camden <POLYGON ((-76.0173492 36.3377304, -76.0328751 36.3359756, -76.0
84+
#> 8 Gates <POLYGON ((-76.46035 36.3738976, -76.5024643 36.4522858, -76.498
85+
#> 9 Warren <POLYGON ((-78.1347198 36.2365837, -78.1096268 36.2135086, -78.0
86+
#> 10 Stokes <POLYGON ((-80.0240555 36.5450249, -80.0480957 36.5471344, -80.4
8587
#> # … with 90 more rows
8688
```
8789

@@ -96,16 +98,16 @@ nc_s2 %>%
9698
#> # A tibble: 100 x 4
9799
#> NAME geometry area perimeter
98100
#> <chr> <s2_geography> <dbl> <dbl>
99-
#> 1 Ashe <POLYGON ((-81.4529 36.2396, -81.431 36.2607, -… 1.14e9 141627.
100-
#> 2 Alleghany <POLYGON ((-81.1767 36.4154, -81.1534 36.4247, … 6.11e8 119876.
101-
#> 3 Surry <POLYGON ((-80.453 36.2571, -80.4353 36.551, -8… 1.42e9 160458.
102-
#> 4 Currituck <MULTIPOLYGON (((-75.9419 36.2943, -75.9575 36.… 6.94e8 301644.
103-
#> 5 Northamp… <POLYGON ((-77.142 36.4171, -77.1393 36.4565, -… 1.52e9 211794.
104-
#> 6 Hertford <POLYGON ((-76.7075 36.2661, -76.7413 36.3152, … 9.68e8 160780.
105-
#> 7 Camden <POLYGON ((-76.0173 36.3377, -76.0329 36.336, -… 6.16e8 150430.
106-
#> 8 Gates <POLYGON ((-76.4604 36.3739, -76.5025 36.4523, … 9.03e8 123170.
107-
#> 9 Warren <POLYGON ((-78.1347 36.2366, -78.1096 36.2135, … 1.18e9 141073.
108-
#> 10 Stokes <POLYGON ((-80.0241 36.545, -80.0481 36.5471, -… 1.23e9 140583.
101+
#> 1 Ashe <POLYGON ((-81.4528885 36.2395859, -81.4310379 … 1.14e9 141627.
102+
#> 2 Alleghany <POLYGON ((-81.1766739 36.4154434, -81.1533661 … 6.11e8 119876.
103+
#> 3 Surry <POLYGON ((-80.4530106 36.2570877, -80.4353104 … 1.42e9 160458.
104+
#> 4 Currituck <MULTIPOLYGON (((-75.9419327 36.2943382, -75.95… 6.94e8 301644.
105+
#> 5 Northamp… <POLYGON ((-77.1419601 36.4170647, -77.1393204 … 1.52e9 211794.
106+
#> 6 Hertford <POLYGON ((-76.7074966 36.2661324, -76.7413483 … 9.68e8 160780.
107+
#> 7 Camden <POLYGON ((-76.0173492 36.3377304, -76.0328751 … 6.16e8 150430.
108+
#> 8 Gates <POLYGON ((-76.46035 36.3738976, -76.5024643 36… 9.03e8 123170.
109+
#> 9 Warren <POLYGON ((-78.1347198 36.2365837, -78.1096268 … 1.18e9 141073.
110+
#> 10 Stokes <POLYGON ((-80.0240555 36.5450249, -80.0480957 … 1.23e9 140583.
109111
#> # … with 90 more rows
110112
```
111113

@@ -117,7 +119,7 @@ nc_s2 %>%
117119
#> # A tibble: 1 x 2
118120
#> NAME geometry
119121
#> <chr> <s2_geography>
120-
#> 1 Catawba <POLYGON ((-80.9313 35.6196, -81.0036 35.6971, -81.0548 35.7134, -81.
122+
#> 1 Catawba <POLYGON ((-80.9312744 35.6195908, -81.0035782 35.6970558, -81.054779
121123
```
122124

123125
Use transformers to create new geometries:
@@ -128,16 +130,16 @@ nc_s2 %>%
128130
#> # A tibble: 100 x 2
129131
#> NAME geometry
130132
#> <chr> <s2_geography>
131-
#> 1 Ashe <LINESTRING (-81.4529 36.2396, -81.431 36.2607, -81.4123 36.2673
132-
#> 2 Alleghany <LINESTRING (-81.1767 36.4154, -81.1534 36.4247, -81.1384 36.417
133-
#> 3 Surry <LINESTRING (-80.453 36.2571, -80.4353 36.551, -80.6111 36.5573,
134-
#> 4 Currituck <MULTILINESTRING ((-75.9419 36.2943, -75.9575 36.2595, -75.9138
135-
#> 5 Northampton <LINESTRING (-77.142 36.4171, -77.1393 36.4565, -77.1273 36.4707
136-
#> 6 Hertford <LINESTRING (-76.7075 36.2661, -76.7413 36.3152, -76.9241 36.392
137-
#> 7 Camden <LINESTRING (-76.0173 36.3377, -76.0329 36.336, -76.044 36.3536,
138-
#> 8 Gates <LINESTRING (-76.4604 36.3739, -76.5025 36.4523, -76.4983 36.503
139-
#> 9 Warren <LINESTRING (-78.1347 36.2366, -78.1096 36.2135, -78.0583 36.211
140-
#> 10 Stokes <LINESTRING (-80.0241 36.545, -80.0481 36.5471, -80.4353 36.551,
133+
#> 1 Ashe <LINESTRING (-81.4528885 36.2395859, -81.4310379 36.2607193, -81…
134+
#> 2 Alleghany <LINESTRING (-81.1766739 36.4154434, -81.1533661 36.4247398, -81…
135+
#> 3 Surry <LINESTRING (-80.4530106 36.2570877, -80.4353104 36.5510445, -80…
136+
#> 4 Currituck <MULTILINESTRING ((-75.9419327 36.2943382, -75.9575119 36.259452
137+
#> 5 Northampton <LINESTRING (-77.1419601 36.4170647, -77.1393204 36.4564781, -77…
138+
#> 6 Hertford <LINESTRING (-76.7074966 36.2661324, -76.7413483 36.3151665, -76…
139+
#> 7 Camden <LINESTRING (-76.0173492 36.3377304, -76.0328751 36.3359756, -76…
140+
#> 8 Gates <LINESTRING (-76.46035 36.3738976, -76.5024643 36.4522858, -76.4
141+
#> 9 Warren <LINESTRING (-78.1347198 36.2365837, -78.1096268 36.2135086, -78…
142+
#> 10 Stokes <LINESTRING (-80.0240555 36.5450249, -80.0480957 36.5471344, -80…
141143
#> # … with 90 more rows
142144
```
143145

@@ -175,5 +177,4 @@ This project gratefully acknowledges financial
175177
[support](https://www.r-consortium.org/projects) from the
176178

177179
<a href="https://www.r-consortium.org/projects/awarded-projects">
178-
<img src="http://pebesma.staff.ifgi.de/RConsortium_Horizontal_Pantone.png" width="300">
179-
</a>
180+
<img src="man/figures/rc300.png" width="300" /> </a>

man/figures/rc300.png

15.3 KB
Loading

0 commit comments

Comments
 (0)