Monday 10 July 2017

QGIS - Creating a new polygon layer from the space between other layers


I wonder if it´s possible with QGIS (2.18) to create a new polygon shapefile directly from the space between Another 2 different polygon layers:



enter image description here


What I would like to do is to fill the gap between the two layers with a feature of a third (new) polygon shapefile. It can be done digitalizing the borders, but If there is a way to do it automatically, I could save a lot of time.



Answer



You can use following workaround where I used layers of next image (with a space between them):


enter image description here




  1. Merge layers with Data Management Tool -> Merge vector layers.





  2. Get polygon from layer extent (merged layer) with Research Tools -> Polygon from layer extent




  3. Get difference for extent and merged layer: Geoprocessing Tools -> Difference. My result was:




enter image description here


As this layer is Multipart it must be converted in Singleparts: Geometry Tools -> Multipart to singleparts.



  1. Select central feature (hole) in singleparts layer and intersect it with merged layer extent (Geoprocessing Tools -> Intersection). Result will be desired layer (hole); as it can be observed at following image.



enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...