ST_MakeBox2D — 创建由两个 2D 点几何图形定义的 BOX2D。
box2d ST_MakeBox2D(geometry pointLowLeft, geometry pointUpRight);
创建由两个 Point 几何图形定义的box2d。 这对于进行范围查询很有用。
Return all features that fall within 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
);