Skip to contents

Removes consecutive duplicate coordinates from each geometry. Accepts linestrings, multilinestrings, polygons, and multipolygons.

Usage

ga_remove_repeated_points(geometry)

Arguments

geometry

a GeoArrow linestring, multilinestring, polygon, or multipolygon array

Value

a GeoArrow array of the same geometry type as the input

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