AW: [postgis-users] Comparison of geometries

Düster Horst Horst.Duester at bd.so.ch
Wed Feb 1 00:22:41 PST 2006


Darren, --strk

Thank you very much for your response. OK boundingbox for comparison is not
enough for some cases. So I modified my query to

select * from old_layer 
where gid not in  
  (select o.gid from new_layer as n, old_layer as o
   where equals(n.the_geom,o.the_geom)
     and n.the_geom && o.the_geom
     and n.art=o.art);

This query works fine now. 

With best regards
 
Dr. Horst Düster 
GIS-Koordinator, Stv. Amtsvorsteher

Kanton Solothurn 
Amt für Geoinformation
Abteilung SO!GIS Koordination
Rötistrasse 4
CH-4501 Solothurn 

Tel.: ++41 (0)32 627 25 32 
Fax: ++41 (0)32 627 22 14

horst.duester at bd.so.ch 
www.sogis.so.ch



> -----Ursprüngliche Nachricht-----
> Von: strk at refractions.net [mailto:strk at refractions.net]
> Gesendet am: Dienstag, 31. Januar 2006 16:39
> An: 'postgis-users at postgis.refractions.net'
> Betreff: Re: [postgis-users] Comparison of geometries
> 
> On Tue, Jan 31, 2006 at 08:34:21AM +0100, Düster Horst wrote:
> > I try to compare two geometry tables with the intension to 
> detect the
> > geometrical and attributive differences between these two 
> tables. For
> > example I attach two tables new and old. Now I want to 
> detect all geometries
> > of the table old which are not in table new. For this issue 
> I use the
> > following query
> > 
> > select the_geom, art from "old"
> > except 
> > select the_geom, art from "new"
> > 
> > but the query doesn't supply the correct result. The 
> correct result should
> > contain two records but the query results 0 records. Now 
> I'm doubt about
> > whether  it's allowed to use geometries in an except clause 
> like other
> > datatypes?? Otherwise in other tables 100% of different 
> geometries will be
> > detected by the query above!
> 
> 'except' will use the binary tree opclass.
> For postgis this just checks bounding boxes equality.
> Reformulate your query to use the ~= operator if you
> want vertex-by-vertex equality, or use the equals()
> function for topological equality.
> 
> --strk;
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 



More information about the postgis-users mailing list