Finding overlapping areas in same polygon layer using QGIS?
QGIS 3.4
- Make sure your polygon layer has a unique id field, such as
id
orfid
. - Run Union tool (
Processing Toolbox > Vector overlay
). It will return a newUnion
layer. - Open the attribute table of this
Union
layer, and create an integer field with an expression as below:count("id", group_by:=geom_to_wkt($geometry))
...... if your id field name is"id"
.
In Database/DB Manager/Virtual layers/Qgis layers you're able to execute the following query (you'll have to adapt the column names...) :
with a as (select * from buffer_table)
select to_real(buffer_table.id) id, count(*) nb from buffer_table,a
where st_intersects(buffer_table.geometry, a.geometry) and a.id<>buffer_table.id
group by buffer_table.id
You load this table and save it in QGIS and join the result to your buffer_table and then you can use the nb column to label or style your buffer objects.
Try this: Processing toolbox - SAGA self intersection your result will like 1|5|7 and so one
via DB manger/SQL you can make a query to "count" '|' as indicator for the number of overlaps:
Create table test_count3 as select length("ID")-length(replace("ID",'|','')) as test, ogc_fid FROM test_split END
join this layer to your self intersection layer via ogc_fid and style it as categorized with the "test" column (But I am sure there is a more elegant way, however it seems to work...)