I have a multipolygon with two parts:

enter image description here

I want to erase the line that separate both parts and get a single polygon that looks like this:

enter image description here

I don't mind if I do it in QGIS or in Postgis, but it has to be only for this multipolygon.

I have read similar posts that suggest a solution to the problem but I had no success so far. I read and tried this, this and this.

I tried postgis functions like ST_Dump, ST_Collect, ST_ConvexHull, St_Union, ST_ExteriorRing, ST_Boundary, etc in SQLs like:

update my_table set the_geom = ST_Boundary(st_snaptogrid(the_geom,0.0001))  where id=3173

I don't really know which is the right approach to achieve this.

PD: If I do ST_NumGeometries I obviously get 2 geometries.

  • 2
    It is not topologically possible to have a valid multipolygon with shared boundaries between parts. You may have a collection.
    – Vince
    Commented Feb 24, 2017 at 12:33

1 Answer 1


It's a kind of hack but you can use ST_Buffer(geom,0)...

Proof of concept:

select 1 as id,
   ST_astext(ST_Buffer(ST_Geomfromtext('MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)),((1 0,1 1,2 1,2 0,1 0)))'),0)) as way

id way

1 POLYGON((0 0,0 1,1 1,2 1,2 0,1 0,0 0))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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