Skip to content

Commit

Permalink
fix tests; fix digits argument in st_astext
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Mar 28, 2024
1 parent 036ed7f commit 6dc5b0e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: lwgeom
Version: 0.2-14
Version: 0.2-15
Title: Bindings to Selected 'liblwgeom' Functions for Simple Features
Description: Access to selected functions found in 'liblwgeom' <https://github.com/postgis/postgis/tree/master/liblwgeom>, the light-weight geometry library used by 'PostGIS' <http://postgis.net/>.
Authors@R: c(person("Edzer", "Pebesma", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0001-8049-7069")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# version 0.2-15

* fix default for argument `digits` in `st_astext()`

# version 0.2-14

* `st_perimeter()` is deprecated in favor of `st_perimeter_lwgeom()`, as `sf` takes over with `sf::st_perimeter()`.
Expand Down
2 changes: 1 addition & 1 deletion R/wkt.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' st_astext(pt, 3)
#' st_asewkt(pt, 3)
#' @export
st_astext <- function(x, digits = options("digits"), ..., EWKT = FALSE) {
st_astext <- function(x, digits = getOption("digits"), ..., EWKT = FALSE) {
if (! EWKT && !inherits(x, "sfg"))
st_crs(x) <- NA_crs_
CPL_sfc_to_wkt(st_geometry(x), as.integer(digits))
Expand Down
4 changes: 2 additions & 2 deletions tests/geod.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ units::set_units(st_geod_area(b), km^2) # approx 111^2

pt = st_point(c(30, 70))
x = st_sfc(pole, pt, pt, crs = 4326)
st_geod_distance(x, x)
st_geod_distance(x, x, sparse = TRUE)
# st_geod_distance(x, x)
# st_geod_distance(x, x, sparse = TRUE)
st_geod_distance(x, x, tolerance = 1, sparse = TRUE)
20 changes: 5 additions & 15 deletions tests/geod.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand Down Expand Up @@ -70,18 +70,8 @@ was `covered_by'
>
> pt = st_point(c(30, 70))
> x = st_sfc(pole, pt, pt, crs = 4326)
> st_geod_distance(x, x)
Units: [m]
[,1] [,2] [,3]
[1,] 0 1378923 1378923
[2,] 1378923 0 0
[3,] 1378923 0 0
> st_geod_distance(x, x, sparse = TRUE)
Sparse geometry binary predicate list of length 3, where the predicate
was `st_is_within_distance'
1: 1
2: 2, 3
3: 2, 3
> # st_geod_distance(x, x)
> # st_geod_distance(x, x, sparse = TRUE)
> st_geod_distance(x, x, tolerance = 1, sparse = TRUE)
Sparse geometry binary predicate list of length 3, where the predicate
was `st_is_within_distance'
Expand All @@ -91,4 +81,4 @@ was `st_is_within_distance'
>
> proc.time()
user system elapsed
0.525 0.035 0.553
0.708 1.257 0.473
11 changes: 4 additions & 7 deletions tests/testthat.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand All @@ -20,11 +20,8 @@ Type 'q()' to quit R.
> suppressPackageStartupMessages(library(lwgeom))
>
> test_check("lwgeom")
══ Skipped tests ═══════════════════════════════════════════════════════════════
• empty test (3)

[ FAIL 0 | WARN 0 | SKIP 3 | PASS 61 ]
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 61 ]
>
> proc.time()
user system elapsed
1.428 0.063 1.485
1.110 1.293 0.896

0 comments on commit 6dc5b0e

Please sign in to comment.