From b70654537f96740f8c3c74e74ded9055f2595ce4 Mon Sep 17 00:00:00 2001 From: Krzysztof Dyba <35004826+kadyb@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:58:09 +0100 Subject: [PATCH 1/2] clarification in vignette 7 regarding `lwgeom` --- vignettes/sf7.Rmd | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/vignettes/sf7.Rmd b/vignettes/sf7.Rmd index 09ce83ec6..47a461ddd 100644 --- a/vignettes/sf7.Rmd +++ b/vignettes/sf7.Rmd @@ -56,7 +56,7 @@ coordinates, meaning that they are associated to points on a flat space, or to unprojected or _geographic_ coordinates, when they refer to angles (latitude, longitude) pointing to locations on a sphere (or ellipsoid). The flat space is also referred to as $R^2$, -the sphere as $S^2$ +the sphere as $S^2$. Package `sf` implements _simple features_, a standard for point, line, and polygon geometries where geometries are built from points @@ -68,7 +68,7 @@ to $R^2$, the two-dimensional flat space. Yet, more and more data are routinely served or exchanged using geographic coordinates. Using software that assumes an $R^2$, flat -space may work for some problems, and although `sf` up to version 0.9-x +space may work for some problems, and although `sf` had some functions in place for spherical/ellipsoidal computations (from package `lwgeom`, for computing area, length, distance, and for segmentizing), it has also happily warned @@ -252,6 +252,12 @@ sf_use_s2(TRUE) # Measures +This section compares the differences in results between the `s2` +and `lwgeom` (`sf_use_s2(FALSE)`) packages for calculating area, +length and distance using geographic coordinates. Note that engaging +the `GEOS` engine would require reprojection of the vector layer +to the planar coordinate system (e.g. `EPGS:3857`). + ## Area ```{r eval=require("lwgeom", quietly = TRUE)} options(s2_oriented = FALSE) # correct orientation from here on @@ -276,10 +282,9 @@ sf_use_s2(FALSE) l2 = st_length(nc_ls) plot(l1 , l2) abline(0, 1) -summary((l1-l2)/l1) +summary((l1 - l2)/l1) ``` - ## Distances ```{r} sf_use_s2(TRUE) @@ -288,7 +293,7 @@ sf_use_s2(FALSE) d2 = st_distance(nc, nc[1:10,]) plot(as.vector(d1), as.vector(d2)) abline(0, 1) -summary(as.vector(d1)-as.vector(d2)) +summary(as.vector(d1) - as.vector(d2)) ``` # Predicates From f3e22e2649876d5f2e6dfe3453dc9e402386e8c6 Mon Sep 17 00:00:00 2001 From: Krzysztof Dyba <35004826+kadyb@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:02:17 +0100 Subject: [PATCH 2/2] change "had" to "has" --- vignettes/sf7.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/sf7.Rmd b/vignettes/sf7.Rmd index 47a461ddd..fd95c7981 100644 --- a/vignettes/sf7.Rmd +++ b/vignettes/sf7.Rmd @@ -69,7 +69,7 @@ to $R^2$, the two-dimensional flat space. Yet, more and more data are routinely served or exchanged using geographic coordinates. Using software that assumes an $R^2$, flat space may work for some problems, and although `sf` -had some functions in place for spherical/ellipsoidal computations +has some functions in place for spherical/ellipsoidal computations (from package `lwgeom`, for computing area, length, distance, and for segmentizing), it has also happily warned the user that it is doing $R^2$, flat computations with such coordinates with messages like