ES|QL ST_SIMPLIFYPRESERVETOPOLOGY function
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Preview
Preview
Stack
Preview
9.4+
Preview since 9.4
Simplifies the input geometry using a topology-preserving Douglas-Peucker algorithm.
geometry- Expression of type
geo_point,geo_shape,cartesian_pointorcartesian_shape. Ifnull, the function returnsnull. tolerance-
Tolerance for the geometry simplification, in the units of the input SRS
Simplifies the input geometry by applying a topology-preserving variant of the Douglas-Peucker algorithm with a specified tolerance. Vertices that fall within the tolerance distance from the simplified shape are removed. Unlike ST_SIMPLIFY, the resulting geometry is guaranteed to be topologically valid.
| geometry | tolerance | result |
|---|---|---|
| cartesian_point | double | cartesian_point |
| cartesian_point | float | cartesian_point |
| cartesian_point | integer | cartesian_point |
| cartesian_point | long | cartesian_point |
| cartesian_shape | double | cartesian_shape |
| cartesian_shape | float | cartesian_shape |
| cartesian_shape | integer | cartesian_shape |
| cartesian_shape | long | cartesian_shape |
| geo_point | double | geo_point |
| geo_point | float | geo_point |
| geo_point | integer | geo_point |
| geo_point | long | geo_point |
| geo_shape | double | geo_shape |
| geo_shape | float | geo_shape |
| geo_shape | integer | geo_shape |
| geo_shape | long | geo_shape |
ROW wkt = "POLYGON ((7.998 53.827, 9.470 53.068, 15.754 53.801, 16.523 57.160, 11.162 57.868, 8.064 57.445, 6.219 55.317, 7.998 53.827))"
| EVAL simplified = ST_SIMPLIFYPRESERVETOPOLOGY(TO_GEOSHAPE(wkt), 0.7)
| wkt:keyword | simplified:geo_shape |
|---|---|
| POLYGON ((7.998 53.827, 9.470 53.068, 15.754 53.801, 16.523 57.160, 11.162 57.868, 8.064 57.445, 6.219 55.317, 7.998 53.827)) | POLYGON ((6.219 55.317, 9.47 53.068, 15.754 53.801, 16.523 57.16, 8.064 57.445, 6.219 55.317)) |