Remove repeated consecutive points from geometries
Source:R/extendr-wrappers.R
ga_remove_repeated_points.RdRemoves consecutive duplicate coordinates from each geometry. Accepts linestrings, multilinestrings, polygons, and multipolygons.
See also
Other misc:
ga_buffer(),
ga_centroid(),
ga_chaikin_smoothing(),
ga_line_segmentize()
Examples
# the middle vertex is recorded twice
line <- geoarrow::as_geoarrow_array(sf::st_sfc(
sf::st_linestring(rbind(c(0, 0), c(1, 1), c(1, 1), c(2, 2)))
))
as.vector(ga_n_coords(line))
#> [1] 4
as.vector(ga_n_coords(ga_remove_repeated_points(line)))
#> [1] 3