ST_Expand — Returns a bounding box expanded from another bounding box or a geometry.
geometry ST_Expand(
geometry geom, float units_to_expand)
;
geometry ST_Expand(
geometry geom, float dx, float dy, float dz=0, float dm=0)
;
box2d ST_Expand(
box2d box, float units_to_expand)
;
box2d ST_Expand(
box2d box, float dx, float dy)
;
box3d ST_Expand(
box3d box, float units_to_expand)
;
box3d ST_Expand(
box3d box, float dx, float dy, float dz=0)
;
Returns a bounding box expanded from the bounding box of the input, either by specifying a single distance with which the box should be expanded on both axes, or by specifying an expansion distance for each axis. Uses double-precision. Can be used for distance queries, or to add a bounding box filter to a query to take advantage of a spatial index.
In addition to the version of ST_Expand accepting and returning a geometry, variants are provided that accept and return box2d and box3d data types.
Distances are in the units of the spatial reference system of the input.
ST_Expand è simile a ST_Buffer, solo che mentre il buffering espande una geometria in tutte le direzioni, ST_Expand espande il rettangolo di selezione lungo ogni asse.
Prima della versione 1.3, ST_Expand veniva utilizzato insieme a ST_Distance per eseguire query di distanza indicizzabili. Ad esempio, |
Disponibilità: 1.5.0 il comportamento è stato modificato per produrre coordinate a doppia precisione anziché float4.
Migliorato: Nella 2.0.0 è stato introdotto il supporto per le superfici poliedriche, i triangoli e i TIN.
Enhanced: 2.3.0 support was added to expand a box by different amounts in different dimensions.
Questa funzione supporta le Polyhedral Surface.
Questa funzione supporta i Triangoli e le Triangulated Irregular Network Surfaces (TIN).
Examples below use US National Atlas Equal Area (SRID=2163) which is a meter projection |
--10 meter expanded box around bbox of a linestring SELECT CAST(ST_Expand(ST_GeomFromText('LINESTRING(2312980 110676,2312923 110701,2312892 110714)', 2163),10) As box2d); st_expand ------------------------------------ BOX(2312882 110666,2312990 110724) --10 meter expanded 3D box of a 3D box SELECT ST_Expand(CAST('BOX3D(778783 2951741 1,794875 2970042.61545891 10)' As box3d),10) st_expand ----------------------------------------------------- BOX3D(778773 2951731 -9,794885 2970052.61545891 20) --10 meter geometry astext rep of a expand box around a point geometry SELECT ST_AsEWKT(ST_Expand(ST_GeomFromEWKT('SRID=2163;POINT(2312980 110676)'),10)); st_asewkt ------------------------------------------------------------------------------------------------- SRID=2163;POLYGON((2312970 110666,2312970 110686,2312990 110686,2312990 110666,2312970 110666))