4

I want to produce a polygon layer out of lines like in this image with the command poligonize:

enter image description here Source: QGIS create boundaries from background image

The problem is that some of the lines are coming from polygons with the command polygon to line tool in QGIS like in this image:

enter image description here Source: How to merge overlapping and duplicate lines from vector layer to one single line?

I am struggling to understand which options I should use in v.clean to remove the overlapping segments of the line layer, or which other stepts or tools I could use to get the desired output in a straight way.

The main asumption is that lines match exactly.

My software QGIS 2.18 and GRASS 7.4

Marco
  • 3,230
  • 14
  • 37
  • I found a related question, but the solution was not done in QGIS https://gis.stackexchange.com/questions/236903/converting-polygon-to-lines-without-duplicate-edges?rq=1 – Marco May 25 '18 at 12:35
  • I cannot understand what do you want to do? Do you want to remove duplicates?Please explain. – Asad Abbas May 30 '18 at 04:29

1 Answers1

1

I couldn't get v.clean to remove duplicates in the way I was expecting using rmdupl (or the -c option*). However, the QGIS algorithm "Delete duplicate geometries" works well. Steps:

  • Break lines at intersections with v.clean's "break"; enter image description here

  • Remove duplicates with "Delete duplicate geometries". enter image description here

  • Create the new polygons with "Polygonize" enter image description here

These could be chained with a single Processing model (click for gist of a model file).

Input polygon -> lines -> break -> remove duplicates -> polygon

*The 'recommended followup tools' in the dialog adds the -c option. From the help: Hint: Breaking lines should be followed by removing duplicates, e.g. v.clean ... tool=break,rmdupl. If the -c flag is used with v.clean ... tool=break, duplicates are automatically removed. Not working in this case for some reason.

Simbamangu
  • 14,773
  • 6
  • 59
  • 93
  • "These could be chained with a single Processing model". That will be impressive! I have never been in the processing model yet, nice idea for the next question – Marco Jun 04 '18 at 07:52
  • I'm on QGIS 3.0 / Ubuntu 16.04 and the model builder dialog is not working but will add that when I get a chance. Thanks for screenshots, didn't have enough time to add workflow. – Simbamangu Jun 04 '18 at 08:46
  • However - I'd point out that 'Polygonize' was not your core question - I have not tested that last step and may remove it here. – Simbamangu Jun 04 '18 at 08:47
  • polygonize was the main goal (first line of my question) and I have tested it, that's why I marked as solved, because it works – Marco Jun 04 '18 at 09:09
  • I've added a link to a processing model - may not work in 2.18 but you can see the steps I've added in the image, should be reproducible. – Simbamangu Jun 06 '18 at 14:10