Simplify a Geometry

Simplify a Geometry

This example shows how to simplify any geometry. Adjust the tolerance parameter to tune how much simpler the shape should be.


using Turf

shape = GeoJSON.parsefile(joinpath(dirname(pathof(Turf)), "..", "docs") * "/examples/simplify/geometry.geojson")

simplify!(shape, 0.4)

result = GeoJSON.geojson(shape)

open(joinpath(dirname(pathof(Turf)), "..", "docs") * "/examples/simplify/geometry.result.geojson", "w") do file
    write(file, result)
end

original:

not_sim

simplified:

sim