Test whether geometries are identical within a tolerance
Source:R/extendr-wrappers.R
ga_equals_exact.RdTRUE when x and y have the same type and structure and every
coordinate lies within tolerance of its counterpart. ga_equals_exact()
recycles y and tolerance against x.
Details
Unlike ga_equals_topo(), ga_equals_exact() compares coordinates in
order, so it does not treat a line and its reverse as equal. It measures
planar distance between coordinates and returns NA for a null on either
side.
Examples
x <- geoarrow::as_geoarrow_array(sf::st_sfc(
sf::st_linestring(rbind(c(0, 0), c(1, 1))),
sf::st_linestring(rbind(c(1, 1), c(0, 0)))
))
y <- geoarrow::as_geoarrow_array(sf::st_sfc(
sf::st_linestring(rbind(c(0, 0), c(1, 1.01)))
))
# ga_equals_exact() does not treat the reversed line as equal
as.vector(ga_equals_exact(x, y, 0.1))
#> [1] TRUE FALSE