Skip to contents

Reduces the number of points in each geometry by removing vertices that deviate less than epsilon from the simplified path. Accepts linestrings, multilinestrings, polygons, and multipolygons.

Usage

ga_simplify(geometry, epsilon)

Arguments

geometry

a GeoArrow linestring, multilinestring, polygon, or multipolygon array

epsilon

the simplification tolerance; length 1 or the same length as geometry

Value

a GeoArrow array of the same geometry type as the input

References

Simplify

See also

Examples

fp <- system.file("shape/nc.shp", package = "sf")
nc <- as.data.frame(read_shapefile(fp))

# a bigger epsilon drops more vertices
head(as.vector(ga_n_coords(nc$geometry)), 3)
#> [1] 27 26 28
head(as.vector(ga_n_coords(ga_simplify(nc$geometry, 0.01))), 3)
#> [1] 19 14 14
head(as.vector(ga_n_coords(ga_simplify(nc$geometry, 0.1))), 3)
#> [1] 5 5 5