Share via


st_simplify function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Simplifies the input GEOMETRY using the Douglas-Peucker algorithm.

Syntax

st_simplify ( geo, tolerance )

Arguments

  • geo: A GEOMETRY value.
  • tolerance: A DOUBLE value that is the distance value used for the simplification. The distance units are those of the CRS of the input geometry.

Returns

A value of type GEOMETRY, representing the simplified geometry.

Points and multipoints remain unchanged. If the input is a geometry collection, the elements of the collection are simplified recursively. If the input geometry has M coordinates they are dropped.

The SRID value of the output geometry is the same as that of the input value.

The function returns NULL if any of the inputs is NULL.

Examples

-- Simplifies linestring with tolerance 0.2.
> SELECT st_astext(st_simplify(st_geomfromtext('LINESTRING(0 0,5.1 0,10 0,10 3,10 8,16 9)'), 0.2))
  LINESTRING(0 0,10 0,10 8,16 9)
-- Returns unchanged point geometry.
> SELECT st_astext(st_simplify(st_geomfromtext('POINT(1 2)'), 1.0))
  POINT(1 2)