Name

ST_MakeBox2D — Creates a BOX2D defined by the given point geometries.

Synopsis

box2d ST_MakeBox2D(geometry pointLowLeft, geometry pointUpRight);

Description

Creates a BOX2D defined by the given point geometries. This is useful for doing range queries

Examples

--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, the_geom
FROM features
WHERE the_geom && ST_SetSRID(ST_MakeBox2D(ST_Point(-989502.1875, 528439.5625),
	ST_Point(-987121.375 ,529933.1875)),2163)

See Also

ST_MakePoint, ST_Point, ST_SetSRID, ST_SRID