﻿---
title: ES|QL ST_SIMPLIFY function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/functions-operators/spatial-functions/st_simplify
products:
  - Elasticsearch
---

# ES|QL ST_SIMPLIFY function
<applies-to>
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Planned
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/images/functions/st_simplify.svg)


## Parameters

<definitions>
  <definition term="geometry">
    Expression of type `geo_point`, `geo_shape`, `cartesian_point` or `cartesian_shape`. If `null`, the function returns `null`.
  </definition>
  <definition term="tolerance">
    Tolerance for the geometry simplification, in the units of the input SRS
  </definition>
</definitions>


## Description

Simplifies the input geometry by applying the Douglas-Peucker algorithm with a specified tolerance. Vertices that fall within the tolerance distance from the simplified shape are removed. Note that the resulting geometry may be invalid, even if the original input was valid.

## Supported types


| 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       |


## Example

```esql
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_SIMPLIFY(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 ((9.47 53.068, 15.754 53.801, 16.523 57.16, 8.064 57.445, 6.219 55.317, 9.47 53.068)) |


### Diagrams

**Low tolerance keeps almost every vertex**
With a small tolerance, only collinear or near-collinear vertices are removed.
![Low tolerance keeps almost every vertex](https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/images/functions/st_simplify_low_tolerance.svg)

**Mid tolerance smooths out the bumps**
A tolerance of `0.2` is large enough to remove the small dents along each edge, leaving the underlying square.
![Mid tolerance smooths out the bumps](https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/images/functions/st_simplify_mid_tolerance.svg)

**Simplifying a circle with tolerance 0.5**
Higher tolerances drop more vertices and the circle becomes a rough polygon.
![Simplifying a circle with tolerance 0.5](https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/images/functions/st_simplify_circle_quarter.svg)

**Simplifying a circle to an octagon**
Tolerance `1.0` reduces the circle to a regular octagon.
![Simplifying a circle to an octagon](https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/images/functions/st_simplify_circle_octagon.svg)

**Simplifying a coastline at moderate tolerance**
France's coastline simplified at tolerance `0.1` (roughly 10 km). Small bays and peninsulas survive but the coastline is noticeably smoother.
![Simplifying a coastline at moderate tolerance](https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/images/functions/st_simplify_france_medium.svg)

**Simplifying a coastline at coarse tolerance**
France's coastline simplified at tolerance `0.5` (roughly 50 km). Only the high-level shape of the country remains.
![Simplifying a coastline at coarse tolerance](https://www.elastic.co/elastic/docs-builder/docs/3256/reference/query-languages/esql/images/functions/st_simplify_france_coarse.svg)