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 or GEOGRAPHY sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo | T | Yes | Geometry or geography value |
tolerance | DOUBLE | Yes | Simplification tolerance |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY
Signature notes:
- Uses the Douglas Peucker algorithm to reduce vertex count
- On GEOMETRY: tolerance is in SRID coordinate units
- On GEOGRAPHY: tolerance is in meters (BigQuery) or degrees (DuckDB, depending on engine)
- Points are returned unchanged
- On Trino: transpiled to simplify_geometry()
- Returns NULL if any input is NULL
Examples
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_SIMPLIFY(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1, 2 0, 3 1, 4 0)'), 1.5)) -- Simplify a zigzag line with high tolerance
;Result
| f1 VARCHAR |
|---|
| LINESTRING (0 0, 4 0) |
On this page