Name

ST_XSize — Returns the X size of a 2D or 3D bounding box or a geometry.

Synopsis

float ST_XSize(box3d aGeomorBox2DorBox3D);

Description

Returns the X size of a 2D or 3D bounding box or a geometry, computed as ST_XMax(aGeomorBox2DorBox3D) - ST_XMin(aGeomorBox2DorBox3D).

[Note]

Although this function is only defined for box3d, it also works for box2d and geometry values due to automatic casting. However it will not accept a geometry or box2d text representation, since those do not auto-cast.

This function supports 3d and will not drop the z-index.

This method supports Circular Strings and Curves.

Availability: 3.7.0

Examples

SELECT ST_XSize('BOX3D(1 2 3, 4 5 6)');
st_xsize
--------
3

SELECT ST_XSize(ST_GeomFromText('LINESTRING(1 3, 5 6)'));
st_xsize
--------
4