名称

ST_MakeBox2D — 通过两个 2D 点几何图形创建 BOX2D。

语法

box2d ST_MakeBox2D(geometry pointLowLeft, geometry pointUpRight);

描述

通过两个点几何图形创建 box2d。这对于执行范围查询很有用。

示例

--Return all features that fall reside or partly reside in a US national atlas coordinate bounding box
--It is assumed here that the geometries are stored with SRID = 2163 (US National atlas equal area)
SELECT feature_id, feature_name, geom
FROM features
WHERE geom && ST_SetSRID(ST_MakeBox2D(ST_Point(-989502.1875, 528439.5625),
	ST_Point(-987121.375 ,529933.1875)),2163)

另请参阅

ST_PointST_SetSRIDST_SRID