s2 icon indicating copy to clipboard operation
s2 copied to clipboard

Tests for NAs returned when X/Y coordinates are nan

Open robitalec opened this issue 2 months ago • 0 comments

Details in #289

Adds tests for NAs returned when X and/or Y coordinates are nan.

Current behaviour:

library(s2)
p1 <- 'POINT (1 1)'
p2 <- 'POINT (2 nan)'
p3 <- 'POINT (nan nan)'

s2_distance_matrix(c(p1, p2, p3), c(p1, p2, p3))
#>          [,1]     [,2] [,3]
#> [1,]        0 20015118   NA
#> [2,] 20015118 20015118   NA
#> [3,]       NA       NA   NA

Expected behaviour:

library(s2)
p1 <- 'POINT (1 1)'
p2 <- 'POINT (2 nan)'
p3 <- 'POINT (nan nan)'

s2_distance_matrix(c(p1, p2, p3), c(p1, p2, p3))
#>          [,1]  [,2] [,3]
#> [1,]        0  NA   NA
#> [2,]       NA  NA   NA
#> [3,]       NA  NA   NA

robitalec avatar Oct 24 '25 16:10 robitalec