8

I need to transform a set of polygons so that it forms an exact spatial partition/tesselation (no gap - no overlap). What are the existing open-source solutions (software or library) to perform this correction? Ideally, I am looking for open-source versions of the ArcGIS integrate.

Integrate is used to maintain the integrity of shared feature boundaries by making features coincident if they fall within the specified x,y tolerance. Features that fall within the specified x,y tolerance are considered identical or coincident.

  • What is the format of the data? – Simbamangu Apr 6 '14 at 13:47
  • whatever format... – julien Apr 6 '14 at 14:18
  • What kind of 'surfaces' are they? Draped 3D polygons of some kind? Or do you mean 'areas', i.e. 2D polygons? – Simbamangu Apr 6 '14 at 15:54
  • Is it like "vector conflation"? Then see gis.stackexchange.com/a/58536/687 – markusN Apr 6 '14 at 17:10
  • @Simbamangu: by 'surface', I mean polygon (correction done). – julien Apr 6 '14 at 17:31
4

Update 2018-05-11: in QGIS 2.18 and 3.0, this is done much more easily (no need to set up a mapset).

  1. Open the v.clean tool in the Processing toolbox.
  2. Select 'snap' as the cleaning tool.
  3. Set the v.in.ogr tolerance as per the instructions below (250 in the example).
  4. Run the tool, and you'll get two new layers - one 'errors' and one 'cleaned'.

Experiment for the right amount of snapping to use - see notes at the end.


You can use a number of GRASS tools to do the job. Just adding the data to a mapset in GRASS using v.in.ogr.qgis may be all you need to do. Using QGIS and GRASS:

Overview:

  1. Open QGIS and make sure the GRASS plugin is turned on (Plugins|Manage...) and visible (View|Toolbars|GRASS).
  2. Add the layer to QGIS.
  3. Create a mapset in GRASS.
  4. Import the layer into GRASS using an appropriate snapping threshold.
  5. Export your data (right-click and save-as from QGIS) back to a format you need.

In detail:

Add your layer that needs gaps / overlaps cleaned up (this is a UTM layer in metres):

Overview of unclean geometry

There are some 'bad' areas that fit your description here (overlaps / gaps):

enter image description here

Select the button on the GRASS toolbar to create a new GRASS mapset:

Toolbar selecting GRASS mapset

You can just use a temporary folder and temporary location name ...

GRASS setup dialogs

...and finally a mapset:

enter image description here

Import your layer from QGIS with the "Open GRASS tools" button then browsing to the tool:

selecting v.in.ogr.qgis

Select your layer, then click 'advanced' and select an appropriate snapping threshold (in this case, 250m - depends on what your data look like!):

enter image description here

Results - original in gray, newly snapped layer in maroon:

enter image description here

NOTE:

  • Small gaps and overlaps get fixed without modifying shapes too much, but the larger the 'snap' the more distortion you may see.
  • The result is a topologically 'clean' geometry, following all of GRASS's rules (read up on that!).
  • There are a LOT of tools (v.clean for one) that can do all kinds of cleaning and fixing.
  • Has this been removed from QGIS 3? I'm not seeing it. – Damien May 11 '18 at 0:30
  • It's been made simpler - see my edit. – Simbamangu May 11 '18 at 5:28

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.