Categories

Site search

QGIS Topological Editing

As we all know, there’s almost always more than one way to do something!

In a previous post (QGIS Trace Edit Tool) I discussed how to use QGIS’ trace edit plugin to create a polygon adjacent to an existing polygon while ensuring that it is topologically correct. With a bit more experimentation, I’ve found a better and easier way to perform the same task, using QGIS’ built-in topological editing functions. It’s easy and super convenient!

The key is that you’ll need to go to Settings > Snapping Options and enable the “Avoid Int.”  checkbox. (The mouseover reads “Avoid intersections of new polygons” and the checkbox doesn’t appear for lines or points, since it doesn’t apply.)

Enable "Avoid Intersections"

Enable "Avoid Intersections"

You can then digitize a polygon beside existing polygons, and have the new feature ‘clipped’ to the boundary. This is faster than using the trace edit plugin like I mentioned before, and it also ensures that no vertices are missed! Fantastic! How about we walk through an example? Pretend we had these existing features:

Existing Features

Existing Features

Now, let us pretend we want to draw a polygon that fills in the hole in the middle. We could simply set our snapping options, zoom way in, and try to snap to every vertex using the standard edit tool. Or, we could use the trace edit tool, and ‘trace’ around the boundary while holding the Ctrl key. OR, we could set the “Avoid intersection” option as shown above, and just quickly sketch in the boundary like so:

New feature boundary

New feature boundary

The red feature above is what I drew in. No need to go carefully, or try to snap to anything. Just roughly sketch in the area I want. Topology rules take care of the rest, clipping the feature to the existing boundary when I finish my sketch. The final product looks like this:

Finished Product

Finished Product

Voila! It’s just that easy! I quickly (not precisely at all) drew in the rough shape required, and ended up with a perfectly topologically correct feature that follows the existing boundary exactly. No need to snap or trace anything! Sweet!

Comments

Comment from coursig
Time October 20, 2011 at 4:50 pm

I try it now !

Comment from Mpho
Time October 25, 2011 at 7:44 am

Cool, very easy and accurate. How do you “clipping the feature to the existing boundary”? Pls break it down step-by-step.

Comment from darrencope
Time October 25, 2011 at 7:55 am

Hi Mpho,

That’s the beauty of it. The “avoid intersections” option takes care of the clipping part. You just enable that setting, and draw the shape roughly, and it takes care of the rest. Give it a try and you’ll see what I mean!

Comment from simbamangu
Time November 23, 2011 at 3:31 am

Topologies don’t work correctly unless you select “enable topological editing” – enabling the snapping only will make the polygons line up nicely but they won’t then be linked as a joint boundary!

Comment from darrencope
Time November 23, 2011 at 6:27 pm

Hi simbamangu,

You’re right–the topological editing checkbox ensures that coincident vertices move at the same time. However, it’s not required to create the non-intersecting shape. You can enable/disable this setting at any time and it’ll work just fine.

Comment from igeopr
Time July 22, 2012 at 10:53 am

ArcGIS’s Auto Complete Polygon editing tool equivalent in QGIS, thanks man, was looking for this for some time.

Comment from Ashok
Time August 9, 2012 at 5:32 am

Can we do topology check in QGIS?

Comment from darrencope
Time August 9, 2012 at 7:14 pm

Hi Ashok. QGIS does not natively have a topology check tool. You may want to use GRASS inside QGIS. Some details at: http://www.youtube.com/watch?v=rb4iqRmcxHY

Comment from Matt BK
Time September 2, 2012 at 12:08 am

Thanks for this tip! I’m fell like I’m finally getting to understand how powerful QGIS can be. This even works to avoid needing to cut rings out separately–if you have an existing polygon, you can draw another polygon around it and it will ring-ify automatically.

Pingback from QGIS auto-trace plugin | Ecostudies
Time February 12, 2014 at 12:54 pm

[…] you are interested in digitizing using QGIS. So let me give you an little bonus tip: check out this blog post about topological editing in […]

Write a comment





Read previous post:
Tour de Brew – Part III

Yes, updates are few and far between. My apologies. For those keeping track, I'm still working on documenting our trip...

Close