[postgis-users] finding duplicate value for the_geom field

Obe, Regina robe.dnd at cityofboston.gov
Tue May 27 05:49:15 PDT 2008


I guess since everyone else is giving their suggestions I might as well
give one too

SELECT the_geom, min(gid) as min_gid, max(gid) as max_gid, COUNT(gid) as
numdupes
FROM sometable
GROUP BY the_geom
HAVING COUNT(gid) > 1


Note that the above query is a bit flawed since I think when you do a
group by on the_geom it actually does a group by on the bounding box
(not the geometry) and returns the first geometry.

I could be wrong though, but that is my understanding.

If you only have 2 dupes, min_gid and max_gid will return the potential
dupes

then you can compare them with a 

g1.the_geom = g2.the_geom  (I think does a binary compare) 

Hope that helps,
Regina



-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Antonio Di Marco
Sent: Tuesday, May 27, 2008 7:57 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] finding duplicate value for the_geom field

Hi, how can I find duplicate value in a PostgreSQL table for the 
geometry field (the_geom)
Thanks a lot

Antonio

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-users mailing list