Thursday 5 December 2019

pyqgis - How do I find the overlapping area between polygons on 2+ vector layers in QGIS when the polygons on all layers are categorized?


Context


I am essentially trying to find the overlapping area between various categories of circles and various categories of polygons.


I looked for a good while at lots of posts and other websites but can't seem to find one that helps with the caveat I have below and the fact that I have categories.


And just as an FYI, I am extremely new to GIS in general and have been going at this problem for a couple days now. I am using QGIS 2.14.15.


Details



First, I have a vector layer with all the counties in Texas. Each county polygon has been categorized into 4 Tiers.


Second, I have 3 vector layers (could be combined later) that are essentially point coordinates that I buffered. Each resulting circle is categorized into 3 Coverage Types.


Just in case I did not explain that well, here is a picture:


Figure 1


I would like to end up with the data to answer the following questions:



  • How much Tier 1 area is covered by Coverage Type 1?

  • How much Tier 2 area is covered by Coverage Type 1?

  • How much Tier 3 area is covered by Coverage Type 1?

  • How much Tier 1 area is covered by Coverage Type 2?


  • Etc... for all Tiers and Coverage Types


And also:



  • What percentage of Coverage Type 1 Area (total) is Tier 1?

  • What percentage of Coverage Type 1 Area (total) is Tier 2?

  • Etc... for all Tiers and Coverage Types


I imagine the output will be in some sort of matrix/table format?


CAVEAT - If circles of the same type overlap, I want to make sure I do not double count (maybe there is a way to combine them temporarily?)




Answer



You do need several geoprocessing steps and there is more than one way to get the needed outcome. All tools mentioned here can be found in the processing toolbox when searching for the tool name. I do not use the tools from the "vector" menue as the newer ones are a bit better and are exchanged in the 2.18 Version of QGIS anyway.


One way is to first using the tool "Merge". When each cirlce has its categories in a column the result will be a new file with the combined geometries and the values from each cirlce in your categories column (if column names match).


enter image description here


You still have overlapping geometries. Therfore you use the tool "Dissolve" and use your categories column. All geometries with the same category are made into one.


Then you use the tool "Union" for the merged circles and your counties. The outcome is a combination of both geometries. In the attribut table you get all column from both layers. You can select all geometry parts based on your categories column. The outcome should look like the following picture. You now have much more geometries then before as you now have all the small pieces. When the column is empty there was no circle in that county.


enter image description here


To get your combination table you use the tool "Statistics from Categories".


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...