ST_SIMPLIFY()

All functions > GEOSPATIAL > ST_SIMPLIFY()

Returns a simplified version of a geometry using the Douglas Peucker algorithm.

Signatures

Simplify

Returns: Simplified geometry, same sub kind as input

ST_SIMPLIFY(geo: T, tolerance: DOUBLE) → GEOMETRY
sql
ParameterTypeRequiredDescription
geoTYesGeometry value
toleranceDOUBLEYesSimplification tolerance

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY

Signature notes:

  • The vertex layout of the result (start vertex, ring orientation, order of parts) is engine-defined: compare two results with ST_EQUALS, not their WKT
  • GEOMETRY only: GEOGRAPHY has no spherical form here; convert with ST_TOGEOMETRY for a planar answer
  • Uses the Douglas Peucker algorithm to reduce vertex count
  • On GEOMETRY: tolerance is in SRID coordinate units
  • Points are returned unchanged
  • On Trino: transpiled to simplify_geometry()
  • Returns NULL if any input is NULL

Availability

StatusBackends
Not availableclickhouse, bigquery, mysql

Examples

FeatureQL
RETURN
    -- Simplify a zigzag line with high tolerance
    f1 := ST_ASTEXT(
        ST_SIMPLIFY(
            ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1, 2 0, 3 1, 4 0)'),
            1.5
        )
    )
;
Result
f1 VARCHAR
LINESTRING (0 0, 4 0)