Returns the positions of the coordinates that survive simplification, rather than the simplified geometry itself. One list per input geometry.
Details
Use these when the coordinates carry data of their own, such as a timestamp or a sensor reading per vertex. Simplifying the geometry discards that alignment; the indices let you subset the other columns the same way.
ga_simplify_idx() uses Ramer-Douglas-Peucker and ga_simplify_vw_idx() uses
Visvalingam-Whyatt, matching ga_simplify() and ga_simplify_vw(). Indices are
1 based and always include the first and last coordinate.
Only linestrings can be simplified this way. Any other geometry type, or a null geometry, comes back null.
See also
Other simplify:
ga_simplify(),
ga_simplify_vw()
Examples
line <- sf::st_linestring(cbind(c(0, 1, 2, 3, 4), c(0, 0.1, 0, 0.1, 0)))
g <- geoarrow::as_geoarrow_array(sf::st_sfc(line))
as.vector(ga_simplify_idx(g, 0.5))
#> <list_of<integer>[1]>
#> [[1]]
#> [1] 1 5
#>