2

QGIS v3.4

I have a single shapefile layer with overlapping features. I wish to intersect the features against themselves and transpose the summary of attributes in the output. The image below will help explain the goal.

What sequence of processing tools should I use to do this? The output should leave me without any overlapping features.

enter image description here

10
  • You can try to use SAGA: Polygon self-intersection Algorithm under processing tools
    – eurojam
    Jul 29, 2019 at 11:27
  • @eurojam That's perfect, do you want to post this as an answer?
    – James B
    Jul 29, 2019 at 12:09
  • @James B: it's not like you described in your image: for each intersection you will not get one new column...for that reason it was only an idea commited as a comment
    – eurojam
    Jul 29, 2019 at 13:32
  • @eurojam You're right, for the most part this has worked by adding new 'ID' field separating each unique value by a pipe. There are some duplicate geometries. The duplicates do not summarise all the values in a single feature but randomly combine them across each overlapping feature. Proceeding this...I have tried the 'point on surface' algorithm followed by the 'join attributes by location (summary)' algorithm on a cleaned version (no duplicates) of the polygon shapefile. The result retains the longest chain of characters in any one of the duplicate geometries/points. Not a solution...
    – James B
    Jul 29, 2019 at 14:32
  • Are u ok with aggregating area types in a single column and a given separator character ?
    – Snaileater
    Jul 29, 2019 at 15:52

1 Answer 1

1

As it was pointed out by @eurojam, you can use "SAGA:Polygon self-intersection Algorithm under processing tools"; but in a PyQGIS script for including only required parameter options and to get desired layer.

For testing above approach, I created a single shapefile layer with overlapping features, similar to your shapefile, where it is not showing intersections by using transparency options:

enter image description here

PyQGIS script ran at Pyton Console of QGIS 3.4 it is as follow:

import processing

polys = QgsVectorLayer("/home/zeito/pyqgis_data/overlapped_features.shp","self_intersections","ogr")
output = "/home/zeito/pyqgis_data/intersection.shp"
processing.runAndLoadResults("saga:polygonselfintersection", 
                {'POLYGONS':polys, 
                 'INTERSECT':output})

After running it, resulting layer can be observed at below image:

enter image description here

It can be also observed that it was create a new field where it is recorded all nine single features or self intersections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.