[postgis-devel] A Note for the PostGIS Manual

Carl Anderson carl.anderson at vadose.org
Sun Jul 9 19:54:40 PDT 2006


This is not a bug (but looks like one at a casual glance)

Users, utilizing  statements using the SQL syntax

select the geom from A
union
select the geom from B;

may not get what they expect if geometries in <A> and <B> have the same 
bounding boxes but have different shapes.

The SQL UNION syntax  uses the bounding box function geometry_eq to 
equate geometries.
Without thinking about this issue I had believed that the SQL UNION 
syntax used geometry_same to equate geometries.

A bit of background

I was working with US Census TIGER data and was looking for lines 
bounding cities. 
While tracing down incomplete bounding shapes I (eventually) guessed 
this as the cause of my problem.

Somewhere in the PostGIS manual this needs to be memorialized.

For clarity

Select asewkt( shape) from
( select geometry('LINESTRING(1 1,5 6,10 10)') as shape
 UNION
 select geometry('LINESTRING(1 1,10 10)') as shape
) as a;

returns one tuple ( the bounding boxes are the same)

Select asewkt( shape) from
( select geometry('LINESTRING(1 1,5 11,10 10)') as shape
 UNION
 select geometry('LINESTRING(1 1,10 10)') as shape
) as a;

returns two tuples as ( the bounding boxes are not the same)

C.



More information about the postgis-devel mailing list