﻿---
title: ES|QL spatial functions
description: ES|QL supports several spatial functions, all of which are aligned with the underlying spatial index grid used in Lucene: 
url: https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions
products:
  - Elasticsearch
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# ES|QL spatial functions
ES|QL supports several spatial functions, all of which are
[aligned with the underlying spatial index grid](/elastic/elasticsearch/pull/151137/reference/query-languages/esql/limitations#esql-limitations-spatial-precision)
used in Lucene:
- Geospatial predicates
  - [`ST_DISTANCE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_distance)
  Computes the distance between two points.
- [`ST_INTERSECTS`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_intersects)
  Returns true if two geometries intersect.
- [`ST_DISJOINT`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_disjoint)
  Returns whether two geometries are disjoint, sharing no points in common.
- [`ST_CONTAINS`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_contains)
  Returns whether the first geometry contains the second geometry.
- [`ST_WITHIN`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_within)
  Returns whether the first geometry is within the second geometry.
- Geometry functions
  - [`ST_X`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_x)
  Extracts the x coordinate from the supplied point.
- [`ST_Y`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_y)
  Extracts the y coordinate from the supplied point.
- [`ST_NPOINTS`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_npoints) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Counts the number of points in the supplied geometry.
- [`ST_BUFFER`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_buffer) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Computes a buffer area around the input geometry at the specified distance.
- [`ST_SIMPLIFY`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_simplify) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Simplifies the input geometry using the Douglas-Peucker algorithm with a specified tolerance.
- [`ST_SIMPLIFYPRESERVETOPOLOGY`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_simplifypreservetopology) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Simplifies the input geometry using a topology-preserving Douglas-Peucker algorithm.
- [`ST_GEOMETRYTYPE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_geometrytype) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Returns the geometry type of the supplied geometry as a string.
- [`ST_DIMENSION`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_dimension) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Returns the topological dimension of the supplied geometry.
- [`ST_ISEMPTY`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_isempty) <applies-to>Elastic Stack: Preview since 9.4</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Returns true if the supplied geometry is empty.
- [`ST_ENVELOPE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_envelope) <applies-to>Elastic Stack: Preview</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Determines the minimum bounding box of the supplied geometry.
  - [`ST_XMAX`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_xmax) <applies-to>Elastic Stack: Preview</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Extracts the maximum x coordinate from the supplied geometry.
- [`ST_XMIN`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_xmin) <applies-to>Elastic Stack: Preview</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Extracts the minimum x coordinate from the supplied geometry.
- [`ST_YMAX`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_ymax) <applies-to>Elastic Stack: Preview</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Extracts the maximum y coordinate from the supplied geometry.
- [`ST_YMIN`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_ymin) <applies-to>Elastic Stack: Preview</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Extracts the minimum y coordinate from the supplied geometry.
- Grid encoding functions
  - [`ST_GEOTILE`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_geotile) <applies-to>Elastic Stack: Preview since 9.2</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Calculates the geotile of the supplied geo_point at the specified precision.
- [`ST_GEOHEX`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_geohex) <applies-to>Elastic Stack: Preview since 9.2</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Calculates the geohex (H3 cell-id) of the supplied geo_point at the specified precision.
- [`ST_GEOHASH`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/151137/reference/query-languages/esql/functions-operators/spatial-functions/st_geohash) <applies-to>Elastic Stack: Preview since 9.2</applies-to> <applies-to>Elastic Cloud Serverless: Preview</applies-to>
  Calculates the geohash of the supplied geo_point at the specified precision.