Given a layer of polygons that is topologically perfect, i.e., has no overlaps or gaps between the polygons, is it possible to manually edit the edges of the polygons in QGIS in a way that preserves the topological correctness?

As illustrated In the image below, suppose I want to change:

  • the "border" between polygons A and B to the red dotted line
  • the "border" between polygons A and C to the yellow dotted line

enter image description here

This is the POSTGIS code to generate the polygons:

CREATE TABLE a_toy_polygons AS
SELECT      1 AS gid, 'A' as name, ST_MakePolygon(ST_GeomFromText('LINESTRING(0 0,1 0  ,1 1,0.5 1,0 1, 0 0)')) AS geom
UNION   SELECT  2 AS gid, 'B' as name, ST_MakePolygon(ST_GeomFromText('LINESTRING(0 1,0.5 1,1 1,1 2  ,0 2, 0 1)')) AS geom
UNION   SELECT  3 AS gid, 'C' as name, ST_MakePolygon(ST_GeomFromText('LINESTRING(1 0,2 0  ,2 1      ,1 1, 1 0)')) AS geom

Notice that in the common "border" between A and B there is already a vertex in the middle. There are actually two superimposed vertexes, one for each polygon. Is there a way to move them simultaneously? Or should I move one, then move the other close while having "snap" activated?

In the "border" of A and C, however, there are no such intermediate vertexes to be moved.

This is, of course, a toy example, my end use would be to fix manually some features of a Postgis topology. I am aware of the "Topology Checker" QGIS plug-in, but that is not capable of moving nodes yet. So I figured it could be possible to cast the topology as a geometry (of polygons) and edit in QGIS.


If these are in the same layer this is pretty straigtforward.

Simply tick the "Topological Editing" box in your snapping options. Then if the two polygons share a node, this node will be moved in both polygons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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