[postgis-devel] PATCH: New positional operators based on Y position of bounding boxes

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Tue Jan 11 03:11:58 PST 2005


Happy New Year everyone! :)

Here is a patch against CVS that addresses a slightly strange omission from
the operators included with PostGIS. One of our import scripts had
accidentally created some geometries with very large Y coordinates (e.g.
POINT(0 1E20)) and in order to delete these rows, I had to select
geometeries above a certain Y-coordinate which is currently not implemented
in PostGIS as an indexable operator (I gave up waiting for over half an hour
for a SELECT... ORDER BY... to complete on a multi-million row table,
whereas it is already possible to do this in seconds on the X-axis using the
<< and >> operators).

This patch implements the following additional operators for PostGIS, with
the ability to use a GiST index where one exists: 

	A <<| B
		The bounding box of A is strictly below the bounding box of
B

	A &<| B
		The bounding box of A vertically overlaps or is below the
bounding box of B	

	A |>> B
		The bounding box of A is strictly above the bounding box of
B

	A |>& B
		The bounding box of A vertically overlaps or is above the
bounding box of B

(to make sense of these operators, it may help to tilt your head 90 degrees
to the right, where the | character represents the X-axis).

I've posted this for review instead of applying directly since I know Paul
was considering reducing the number of operators included in PostGIS. I have
done some simple tests using both sequential and index scans, and confirmed
that the new operators return the expected results. Comments anyone?


Kind regards,

Mark.

------------------------
WebBased Ltd
South West Technology Centre
Tamar Science Park
Plymouth
PL6 8BT 

T: +44 (0)1752 791021
F: +44 (0)1752 791023
W: http://www.webbased.co.uk
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgis-yoperator.diff
Type: application/octet-stream
Size: 17887 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20050111/22e1a7ff/attachment.obj>


More information about the postgis-devel mailing list