I'm working with QGIS to find overlapping area's in a polygon layer.
Some more info : The Layers contains multiple circles ( buffers ) and i need to find where there is an overlapping area of 3 or more circles. And based on how many circles overlap they have to get a different color / style.
Does anybody know a fast workflow for this?
-
Do your buffers have known and constant diameters ?Snaileater– Snaileater2019年02月12日 09:44:15 +00:00Commented Feb 12, 2019 at 9:44
-
Yes, 750m radiusKoen Venken– Koen Venken2019年02月12日 09:46:15 +00:00Commented Feb 12, 2019 at 9:46
-
If it's only for styling (ie. you don't need the number of overlap recorded in the table) you can play with the styling option "feature blending mode" (it's in the layer rendering part) for exemple setting it to multiply give you darker shade the more overlaping feature you haveJ.R– J.R2019年02月12日 10:00:15 +00:00Commented Feb 12, 2019 at 10:00
-
That's usefull but it would be ideal to have the number of overlap in the record table.Koen Venken– Koen Venken2019年02月12日 10:11:20 +00:00Commented Feb 12, 2019 at 10:11
-
1you could rasterize the layers and burn the sum into the raster layer. Then separate the buffers at intersection and perform a raster statistic with the zonal statistics toolLeo– Leo2019年02月12日 12:10:02 +00:00Commented Feb 12, 2019 at 12:10
3 Answers 3
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"
.
-
Thanks very much! This works perfect and was just what i needed.Koen Venken– Koen Venken2019年02月12日 14:26:24 +00:00Commented Feb 12, 2019 at 14:26
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...) enter image description here
-
when did this algorithm appear ?Snaileater– Snaileater2019年02月12日 12:52:13 +00:00Commented Feb 12, 2019 at 12:52
-
don't know stumbled upon it a few days ago, when i had a similar problem.user16032– user160322019年02月12日 12:56:37 +00:00Commented Feb 12, 2019 at 12:56
-
Hi there - I am trying to achieve the above but not quite getting there- I'm wondering if you could provide a little more detail ( I am not familiar with SQL syntax so I'm a bit out of my depth) - I am running the SQL -- create table test_count3 as select length("ID")-length(replace("ID",'|',")) as test, ogc_fid FROM test_split end, but I am getting errorsN-particle– N-particle2020年08月10日 02:14:19 +00:00Commented Aug 10, 2020 at 2:14