ST_Expand — 返回从另一个边框或几何图形展开的边框。
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
)
;
通过指定框应在两个轴上展开的单个距离,或通过指定每个轴的展开距离,返回从输入的边框展开的边框。使用双精度。可用于距离查询,或用于向查询添加边界框筛选器以利用空间索引。
除了接受和返回几何的ST_Expand版本之外,还提供了接受和返回的变体 框2d 和 方框3d 数据类型。
距离以输入的空间参考系为单位。
ST_Expand类似于 ST_Buffer ,除非缓冲在所有方向上扩展几何体,而ST_Expand则沿每个轴扩展边界框。
![]() |
|
在1.3版之前,ST_Expand与
ST_Distance
以执行可索引距离查询。例如,
|
可用性:1.5.0行为更改为输出双精度,而不是浮动4坐标。
增强:2.0.0引入了对多面体曲面、三角形和三角网的支持。
增强:增加2.3.0支持,可以在不同的维度以不同的数量扩展一个盒子。
This function supports Polyhedral surfaces.
This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).
![]() |
|
下面的示例使用美国国家地图集等面积(SRID=2163),这是一个米投影 |
--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))