Applies Chaikin's corner-cutting algorithm for the given number of iterations to produce smoother curves. Accepts linestrings, multilinestrings, polygons, and multipolygons.
See also
Other misc:
ga_buffer(),
ga_centroid(),
ga_line_segmentize(),
ga_remove_repeated_points()
Examples
zigzag <- geoarrow::as_geoarrow_array(sf::st_sfc(
sf::st_linestring(rbind(c(0, 0), c(1, 2), c(2, 0), c(3, 2)))
))
# each iteration cuts every corner, so the vertex count grows
as.vector(ga_n_coords(zigzag))
#> [1] 4
as.vector(ga_n_coords(ga_chaikin_smoothing(zigzag, 2)))
#> [1] 16
geoarrow::as_geoarrow_vctr(ga_chaikin_smoothing(zigzag, 1))
#> <geoarrow_vctr geoarrow.linestring{list}[1]>
#> [1] <LINESTRING (0 0, 0.25 0.5, 0.75 1.5, 1.25 1.5, 1.75 0.5, 2.25 0.5, 2.7>