3

I get polylines automatically generated from AutoCAD from a colleague. Converting them into polygons with QGIS 3.6, I find out some sliver polygons and gaps in between, as shown in the picture below :

Raw data

So far, I am correcting mostly by hand which is time consuming, as detailed follow :

To get rid of sliver polygons, I am using the command v.generalize from the GRASS Module, then remove the duplicated geometries and merge manually polygons with the same number.

To fill gaps, I am adding a new feature by clicking on the gap with the tool "Fill gapp with a new feature" from the digitizing tool plugin, and merge manually polygons.

Any of you have an idea to automate the process, or at least speed it up?

The aim is to get a result like this :

Expected result

  • In order to speed up the process, simply select and create problem polygons with a buffer, remove them from the main layer, then cut them with a layer with adjacent polygons, and then merge the two working layers into one again ... – Cyril Jun 24 at 14:53
  • Refer to this post. The top answer is for ArcGIS but there are QGIS/GRASS solutions further down: gis.stackexchange.com/questions/11004/… – RGfromRWBJV Jun 24 at 16:44
  • You may want to look at the "v.clean.ogr" addon, it imports vector data into a GRASS vector map, cleans the data topologically, and exports them again using OGR library. See: grass.osgeo.org/grass7/manuals/addons/v.clean.ogr.html – markusN Jun 30 at 20:55
0

First of all many thanks for your answers.

@Cyril I indeed do this to fill the gaps

@RGfromRWBJV I also use this tool to clean the layer

@markusN I also used this solution to clean the layer

There is no simple solution on this. Despite these functions, none of them are perfect.

Therefore the simplest way to do this is : - the snapping option from the cleaning/generalizing tool, - drawing a polygons covering the entire surface, using the symmetrical differences to generates the polygons and fulfill the "holes" in using the function "Eliminate Selected Polygons with the option "sharing the largest common boundary with the adjacent polygon"

0

I had the same problem some months ago, and overcame it used shapely and geopandas, here is my solution on github

It's a simple python Class that gets for every vertex the closest one in a distance you can define, if no vertex is within that distance it creates a new one and snap to it. You can execute with :

python auto_snap.py "path/to/layer.shp" Tolerance_value

the result is another shapefile with the polygons ( or even lines ) snapped to each other

  • Thanks for your reply. Unfortunately I do not know how to use it yet, could you describe how to use it? I definitely need to learn how to use and code simple script in python. – Xavier Michael Jul 29 at 8:30

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.