The following example lists the ShapeIDs where the rectangle specified by the envelope of the two points intersects the corresponding
Shape geometry. This example returns the result 3,5,6,18.
SELECT LIST( ShapeID ORDER BY ShapeID )
FROM SpatialShapes
WHERE Shape.ST_IntersectsRect( NEW ST_Point( 0, 4 ), NEW ST_Point( 2, 5 ) ) = 1
The following example tests if a linestring intersects a rectangle. The provided linestring does not intersect the rectangle
identified by the two points (even though the envelope of the linestring does intersect the envelope of the two points).
SELECT NEW ST_LineString( 'LineString( 0 0, 10 0, 10 10 )' )
.ST_IntersectsRect( NEW ST_Point( 4, 4 ) , NEW ST_Point( 6, 6 ) )