Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hello I have the following problem:

I created a grid in QGIS. For some unknown reason QGIS doesn't tesselate the plane correctly. Sometimes there are polygons with different "id" that represents the same portion of the area. I loaded the Shapefile into postgis (without noticing this) and began to have troubles in queries. When I look for the problem I saw that sometimes 2 or even 4 polygons represent exactly the same region. How could I delete those repeating polygons?

share|improve this question
up vote 0 down vote accepted

For my_table where gid is the primary key and geom is the geometry column, try:

DELETE FROM my_table
    select max(dup.gid)
    from my_table as dup
    group by geom);

Note: make a backup of this table beforehand, in case things go wrong.

share|improve this answer
I not sure if this really works in all situations. I think that group by, = , ... on geometries operates with the bounding box and not with the real geometry, – Francisco Puga Aug 16 '13 at 15:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.