ST_SIMPLIFY
functionsupportedCore SQL functionsGiven an input GEOGRAPHY or GEOMETRY object that represents a Line or Polygon, returns a simpler approximation of the object. The function identifies and removes selected vertices, resulting in a similar object that has fewer vertices. For example, if the input object is a Polygon with 50 vertices, ST_SIMPLIFY can return a simpler Polygon with only 20 of those vertices. When simplifying an object, the function removes a vertex only if the distance between that vertex and the edge resulting from the removal of that vertex is within the specified tolerance.
Syntax
supportedpartialnot supportednot scored
ST_SIMPLIFY( <geography_expression>, <tolerance> [ , <preserve_collapsed> ] )
ST_SIMPLIFY( <geometry_expression>, <tolerance> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_expression OR geometry_expression | required | The GEOGRAPHY or GEOMETRY object to simplify. Depending on the type of the GEOGRAPHY or GEOMETRY object, ST_SIMPLIFY has the following effect: Type of Object Effect of ST_SIMPLIFY LineString, MultiLineString, Polygon, or MultiPolygon ST_SIMPLIFY applies the simplification algorithm Point or MultiPoint ST_SIMPLIFY has no effect. GeometryCollection or FeatureCollection For GEOGRAPHY objects, ST_SIMPLIFY applies the simplification algorithm to each object in the collection. For GEOMETRY objects, ST_SIMPLIFY does not support these types.ExpandShow lessSee more |
tolerance | required | The maximum distance used by the simplification algorithm. Depending on the data type of the object, the following units are used for the operation: GEOGRAPHY - Distance is interpreted in meters. GEOMETRY - Distance is interpreted in the units of the object’s SRID (spatial reference system identifier). For example, the distance is interpreted in degrees for EPSG:4326, in meters for many projected SRIDs, or in feet for some local SRIDs. If the distance exceeds this tolerance for a candidate vertex, ST_SIMPLIFY keeps that vertex in the simplified object. |
preserve_collapsed | optional | (For GEOGRAPHY objects only) If TRUE, retains objects that would otherwise be too small given the tolerance. For example, when preserve_collapsed is FALSE and tolerance is 10 (meters), a 1m long line is reduced to a point in the simplified object. When preserve_collapsed is TRUE, the line is preserved in the simplified object. Default: FALSE. |
Returns
The function returns a value of type GEOGRAPHY or GEOMETRY.