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

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


## Syntax

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


## Parameters

<definitions>
  <definition term="point">
    Expression of type `geo_point`, `geo_shape`, `cartesian_point` or `cartesian_shape`. If `null`, the function returns `null`.
  </definition>
</definitions>


## Description

Extracts the maximum value of the `x` coordinates from the supplied geometry. If the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the maximum `longitude` value.

## Supported types


| point           | result |
|-----------------|--------|
| cartesian_point | double |
| cartesian_shape | double |
| geo_point       | double |
| geo_shape       | double |


## Example

```esql
FROM airport_city_boundaries
| WHERE abbrev == "CPH"
| EVAL envelope = ST_ENVELOPE(city_boundary)
| EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope)
| KEEP abbrev, airport, xmin, xmax, ymin, ymax
```


| abbrev:keyword | airport:text | xmin:double       | xmax:double        | ymin:double       | ymax:double        |
|----------------|--------------|-------------------|--------------------|-------------------|--------------------|
| CPH            | Copenhagen   | 12.45299999602139 | 12.639799928292632 | 55.63179998192936 | 55.732699991203845 |