[postgis-devel] A Note for the PostGIS Manual

strk at refractions.net strk at refractions.net
Thu Jul 20 16:06:16 PDT 2006


Just to complete the picture: the SQL UNION syntax, like the
DISTINCT, GROUP BY and ORDER BY ones, use the btree operators
class.

For PostGIS, the btree opclass has been implemented using
bbox-based operations, but it is not necessarily the right
thing. I think it's not documented for specifically this reason.
A wider discussion might bring to a change in this behaviour
(I don't think anyone relies on that syntax on geometries)

--strk;

On Sun, Jul 09, 2006 at 10:54:40PM -0400, Carl Anderson wrote:
> 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.
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel

-- 

 /"\    ASCII Ribbon Campaign
 \ /    Respect for low technology.
  X     Keep e-mail messages readable by any computer system.
 / \    Keep it ASCII. 




More information about the postgis-devel mailing list