Share via


st_xmax function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns the maximum X coordinate of the input GEOMETRY, or NULL if the geometry is empty.

Syntax

st_xmax ( geoExpr )

Arguments

  • geoExpr: A GEOMETRY value.

Returns

A value of type DOUBLE, maximum X coordinate of the input GEOMETRY.

The function returns NULL if the input is NULL or if the geometry is empty.

Examples

-- Returns the maximum X coordinate of a non-empty geometry.
> SELECT st_xmax(st_geomfromtext('LINESTRING(10 34,44 57,30 24)'))
  44.0
-- Returns `NULL` for an empty geometry.
> SELECT st_xmax(st_geomfromtext('POLYGON EMPTY'))
  NULL