Reduce (geometry Data Type)

Returns an approximation of the given geometry instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.

Syntax

.Reduce ( tolerance )

Arguments

  • tolerance
    Is a value of type float. tolerance is the tolerance to input to the Douglas-Peucker algorithm.

Return Types

SQL Server return type: geometry

CLR return type: SqlGeometry

Remarks

For collection types, this algorithm operates independently on each geometry contained in the instance.

This algorithm does not modify Point instances.

On LineString instances, the Douglas-Peucker algorithm retains the original start and end points of the instance, and iteratively adds back the point from the original instance that most deviates from the result until no point deviates more than the given tolerance.

On Polygon instances, the Douglas-Peucker algorithm is applied independently to each ring. The method will produce a FormatException if the returned Polygon instance is not valid; for example, an invalid MultiPolygon instance is created if Reduce() is applied to simplify each ring in the instance and the resulting rings overlap.

Examples

The following example creates a LineString instance and uses Reduce() to simplify the instance.

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 0 1, 1 0, 2 1, 3 0, 4 1)', 0);
SELECT @g.Reduce(.75).ToString();

See Also

Other Resources