Returns the X maxima of the bounding box of a Box2D, Box3D, or geometry object.
Syntax
float ST_XMax(box3d aGeomorBox2DorBox3D)Parameters
| Parameter | Description |
|---|---|
aGeomorBox2DorBox3D | The Box2D, Box3D, or geometry object. |
Usage notes
The parameter type is declared as box3d, but the function accepts Box2D and geometry objects through auto-casting. Auto-casting does not work when Box2D or geometry objects are passed as plain strings — the function cannot process Box2D or geometry objects in that form.
The function supports 3D objects and preserves z coordinates. It also supports circular strings and curves.
Examples
Box3D input
SELECT ST_XMax('BOX3D(1 2 3, 4 5 6)');
st_xmax
---------
4
(1 row)Geometry input via ST_GeomFromText
SELECT ST_XMax(ST_GeomFromText('LINESTRING(1 3 4, 5 6 7)'));
st_xmax
---------
5
(1 row)Box2D input with explicit cast
SELECT ST_XMax(CAST('BOX(-3 2, 3 4)' AS box2d));
st_xmax
---------
3
(1 row)Default geometry cast (LineString)
SELECT ST_XMax('LINESTRING(0 1,2 3)'::geometry);
st_xmax
---------
2
(1 row)该文章对您有帮助吗?