Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add s2_cell_union() vector class #164

Merged
merged 19 commits into from Jan 24, 2022
Merged

Add s2_cell_union() vector class #164

merged 19 commits into from Jan 24, 2022

Conversation

paleolimbot
Copy link
Collaborator

This PR adds lower-level access to the S2CellUnion C++ class, which powers s2 indexing. It completes #85 and adds the functionality requested in #94.

Under the hood these are list(s2_cell()) (no external pointers).

library(s2)

geog <- s2_data_countries("Germany")
(covering <- s2_covering_cell_ids(geog))
#> <s2_cell_union[1]>
#> List of 1
#> $ : s2_cell[1:8] 4707, 470c, 4775, 4777, 4794, 479c, 47b , 47c4
interior_covering <- s2_covering_cell_ids(geog, interior = TRUE)

s2plot::s2plot(geog)
s2plot::s2plot(covering, add = T)
s2plot::s2plot(interior_covering, add = T)

as_s2_geography(covering)
#> <s2_geography[1]>
#> [1] <POLYGON ((6.0275303 49.8623037, 5.50935844 47.3168538, 8.47114463 47.1357861, 11.5441739 46.8652403, 13.1147522 46.6939166...>

Still TODO:

  • Add some optimized methods since in theory working with cells is way faster than working with geographies

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2022

Codecov Report

Merging #164 (1f8564b) into main (a323a74) will increase coverage by 0.33%.
The diff coverage is 98.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #164      +/-   ##
==========================================
+ Coverage   94.56%   94.89%   +0.33%     
==========================================
  Files          40       42       +2     
  Lines        2871     3176     +305     
==========================================
+ Hits         2715     3014     +299     
- Misses        156      162       +6     
Impacted Files Coverage Δ
src/s2-cell.cpp 98.98% <93.33%> (-0.74%) ⬇️
R/s2-cell-union.R 97.91% <97.91%> (ø)
src/s2-cell-union.cpp 99.45% <99.45%> (ø)
R/s2-cell.R 100.00% <100.00%> (ø)
src/s2-transformers.cpp 96.56% <0.00%> (-0.01%) ⬇️
R/s2-transformers.R 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a323a74...1f8564b. Read the comment docs.

@paleolimbot paleolimbot merged commit e3ec360 into main Jan 24, 2022
@paleolimbot paleolimbot deleted the cell-union branch January 25, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants