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

I have a hand-digitized coverage stored in postgis. There, I have a few shiver-polygons I would like to get rid of by including them into one of the neighbouring polygons.

are there any commands that can be used to do that?

Something like

update coverage set the_geom=st_union(...) ...

Of cource, I want to use the attributes from the large polygon - I must be able t decide which way the union goes.

share|improve this question
up vote 4 down vote accepted


UPDATE coverage SET the_geom = ST_Union(
(SELECT the_geom FROM coverage WHERE id = :polygon_id),
(SELECT the_geom FROM coverage WHERE id = :sliver_id)
WHERE id = :polygon_id;

Is that what You meant?

share|improve this answer
Looks good - if I just can use it to update the data set. I'll test it later today. Thanks! – MortenSickel Feb 5 '13 at 9:30
You're welcome :) – Rauni Feb 5 '13 at 9:35

First of all, You need to find a way to define what polygons are slivers, and what not.

Borrowing from here: Sliver triangle

slivers are usually defined by having much smaller area/volume than its circumcircle.

Secondly, for each sliver polygon You could run such algorithm: detect, if there is any polygon that overlaps/touches with the sliver polygon. If there are many that overlap, prefer the one that has biggest common area with sliver polygon; If none of polygons overlap with the sliver polygon, find the one that's exterior has biggest common length with sliver polygon's exterior. Like this You will find the polygon that You should connect the sliver to.

Then just update the polygon with ST_Union(polygon, sliver). However, if polygon and sliver polygon only have one point in common, then union of these two geometries would not be valid. (or it will be MultiPolygon).

Alternatively, see here: ArcGIS 10.1 - How Polygon Neighbouring Works This is interesting article on same topic.

share|improve this answer
I know exactly which polygons I want to get rid of, and I know which to merge them with. (the luck of having a not too big data set and a reasonably good person doing the digitizing...) - but anyhow, thanks for your info, I'll look it up. – MortenSickel Feb 5 '13 at 8:46
Then You need help with forming the SQL of finding union of two geometries, provided You know the IDs of both geometries? – Rauni Feb 5 '13 at 9:08
That's correct, that what I tried to say in the original post ;-) – MortenSickel Feb 5 '13 at 9:24

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.