Skip to content

Commit

Permalink
fix bug in centroid code chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
clementinecttn committed Feb 14, 2024
1 parent 9413a03 commit 4d424a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion episodes/19-basic-gis-with-r-sf.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ We create unique IDs to identify the new polygons.
For the sake of visualisation speed, we would like to represent buildings by a single point (for instance: their geometric centre) rather than their actual footprint. This operation means defining their _centroid_ and the corresponding function is `st_centroid()`.

```{r}
sf::sf_use_s2(FALSE). # s2 works with geographic projections, so to calculate centroids in projected CRS units (meters), we need to disable it.
sf::sf_use_s2(FALSE) # s2 works with geographic projections, so to calculate centroids in projected CRS units (meters), we need to disable it.
centroids_old <- st_centroid(old_buildings) %>%
st_transform(.,crs=28992)
Expand Down
3 changes: 2 additions & 1 deletion instructors/4-gis-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ function is `st_centroid`.
## Centroids

```{r centroids}
sf::sf_use_s2(FALSE) # s2 works with geographic projections, so to calculate centroids in projected CRS units (meters), we need to disable it.
sf::sf_use_s2(FALSE) # s2 works with geographic projections, so to calculate centroids in projected CRS units (meters), we need to disable it
centroids_old <- st_centroid(old_buildings) %>%
st_transform(.,crs=28992)
Expand Down

0 comments on commit 4d424a3

Please sign in to comment.