Skip to content

Bounding Box Functions

Idan Sheinberg edited this page Jun 4, 2022 · 1 revision

ST_XMax

Description: Extract the X maxima of a Geometry
Input Argument #1: Geometry (WKB)
Output: X maxima

SELECT ST_XMax(
  ST_GeomFromText(
    'POLYGON((0.5 0.5,5 0,5 5,0 5,0.5 0.5), (1.5 1,4 3,4 1,1.5 1))'
  )
)

Result

5.0

ST_XMin

Description: Extract the X minima of a Geometry
Input Argument #1: Geometry (WKB)
Output: X minima

SELECT ST_XMin(
  ST_GeomFromText(
    'POLYGON((0.5 0.5,5 0,5 5,0 5,0.5 0.5), (1.5 1,4 3,4 1,1.5 1))'
  )
)

Result

0.0

ST_YMax

Description: Extract the Y maxima of a Geometry
Input Argument #1: Geometry (WKB)
Output: Y maxima

SELECT ST_YMax(
  ST_GeomFromText(
    'LINESTRING(1.5 2.45,3.21 4)'
  )
)

Result

4.0

ST_YMin

Description: Extract the Y minima of a Geometry
Input Argument #1: Geometry (WKB)
Output: Y minima

SELECT ST_YMin(
  ST_GeomFromText(
    'LINESTRING(1.5 2.45,3.21 4)'
  )
)

Result

2.45
Clone this wiki locally