ST_XMax
Returns the maximum x-coordinate of the minimum bounding rectangle of the GEOMETRY or GEOGRAPHY object.
Returns the maximum x
-coordinate of the minimum bounding rectangle of the GEOMETRY or GEOGRAPHY object.
For GEOGRAPHY types, Vertica Place computes maximum coordinates by calculating the maximum longitude of the great circle arc from (MAX(longitude), ST_YMin(GEOGRAPHY)) to (MAX(longitude), ST_YMax(GEOGRAPHY)). In this case, MAX(longitude) is the maximum longitude value of the geography object.
If either latitude or longitude is out of range, ST_XMax returns the maximum plain value of the geography object.
Behavior type
ImmutableSyntax
ST_XMax( g )
Arguments
g
- Spatial object for which you want to find the maximum
x
-coordinate, type GEOMETRY or GEOGRAPHY.
Returns
FLOAT
Supported data types
Data Type | GEOMETRY | GEOGRAPHY (Perfect Sphere) |
---|---|---|
Point | Yes | Yes |
Multipoint | Yes | Yes |
Linestring | Yes | Yes |
Multilinestring | Yes | Yes |
Polygon | Yes | Yes |
Multipolygon | Yes | Yes |
GeometryCollection | Yes | No |
Examples
The following examples show how to use ST_XMax.
Returns the maximum x
-coordinate within a rectangle:
=> SELECT ST_XMax(ST_GeomFromText('POLYGON((0 1,0 2,1 2,1 1,0 1))'));
ST_XMax
-----------
1
(1 row)
Returns the maximum longitude value within a rectangle:
=> SELECT ST_XMax(ST_GeographyFromText(
'POLYGON((-71.50 42.35, -71.00 42.35, -71.00 42.38, -71.50 42.38, -71.50 42.35))'));
ST_XMax
---------
-71
(1 row)