Skip to content

Commit

Permalink
Add s2 note, close #748
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Feb 15, 2022
1 parent c6413bb commit 020e0dc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 02-spatial-data.Rmd
Expand Up @@ -828,6 +828,14 @@ Turn it on again with the following command.
sf_use_s2(TRUE)
```

```{block2 09-gis-2, type="rmdnote"}
Although the **sf**'s used of S2 makes sense in many cases, in some cases there are good reasons for turning S2 off for the duration of an R session or even for an entire project.
As documented in issue [1771](https://github.com/r-spatial/sf/issues/1771) in **sf**'s GitHub repo, the default behavior can make code that would work with S2 turned off (and with older versions of **sf**) fail.
These edge cases include operations on polygons that are not valid according to S2's stricter definition.
If you see error message such as `#> Error in s2_geography_from_wkb ...` it may be worth trying the command that generated the error message again, after turning off S2.
To turn off S2 for the entirety of a project you can create a file called .Rprofile in the root directory (the main folder) of your project containing the command `sf::sf_use_s2(FALSE)`.
```

## Raster data

The spatial raster data model represents the world with the continuous grid of cells (often also called pixels; Figure \@ref(fig:raster-intro-plot):A).
Expand Down

0 comments on commit 020e0dc

Please sign in to comment.