Skip to content

Commit

Permalink
improves 02 fig
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowosad authored and Robinlovelace committed Feb 7, 2022
1 parent ce2f762 commit 1b3e9b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions 02-spatial-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -804,16 +804,18 @@ india_buffer_without_s2 = st_buffer(india, 1)
```{r s2example, echo=FALSE, fig.cap="Example of the consequences of turning off the S2 geometry engine. Both representations of a buffer around India were created with the same command but the purple polygon object was created with S2 switched on, resulting in a buffer of 1 m. The larger light green polygon was created with S2 switched off, resulting in a buffer with inaccurate units of degrees longitude/latitude."}
library(tmap)
tm1 = tm_shape(india_buffer_with_s2) +
tm_fill(col = hcl.colors(4, palette = "purple green")[2]) +
tm_fill(col = hcl.colors(4, palette = "purple green")[3]) +
tm_shape(india) +
tm_fill(col = "grey95") +
tm_layout(main.title = "s2 switched on")
tm_layout(main.title = "st_buffer() with dist = 1",
title = "s2 switched on (default)")
tm2 = tm_shape(india_buffer_without_s2) +
tm_fill(col = hcl.colors(4, palette = "purple green")[3]) +
tm_shape(india) +
tm_fill(col = "grey95") +
tm_layout(main.title = "s2 switched off")
tm_layout(main.title = " ",
title = "s2 switched off")
tmap_arrange(tm1, tm2, ncol = 2)
```
Expand Down

0 comments on commit 1b3e9b5

Please sign in to comment.