DouglasPeuckerSimplifier class

Simplifies a {@link Geometry} using the Douglas-Peucker algorithm. Ensures that any polygonal geometries returned are valid. Simple lines are not guaranteed to remain simple after simplification. All geometry types are handled. Empty and point geometries are returned unchanged. Empty geometry components are deleted.

Note that in general D-P does not preserve topology - e.g. polygons can be split, collapse to lines or disappear holes can be created or disappear, and lines can cross. To simplify geometry while preserving topology use {@link TopologyPreservingSimplifier}. (However, using D-P is significantly faster).

KNOWN BUGS

  • In some cases the approach used to clean invalid simplified polygons can distort the output geometry severely.

Constructors

DouglasPeuckerSimplifier(Geometry inputGeom)

Properties

hashCode int
The hash code for this object.
no setterinherited
inputGeom Geometry
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getResultGeometry() Geometry?
Gets the simplified geometry.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setDistanceTolerance(double distanceTolerance) → void
Sets the distance tolerance for the simplification. All vertices in the simplified geometry will be within this distance of the original geometry. The tolerance value must be non-negative.
setEnsureValid(bool isEnsureValidTopology) → void
Controls whether simplified polygons will be "fixed" to have valid topology. The caller may choose to disable this because:
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

simplify(Geometry geom, double tolerance) Geometry?
Simplifies a geometry using a given tolerance.