6

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?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 12, 2019 at 9:35
5
  • Do your buffers have known and constant diameters ? Commented Feb 12, 2019 at 9:44
  • Yes, 750m radius Commented 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 have Commented Feb 12, 2019 at 10:00
  • That's usefull but it would be ideal to have the number of overlap in the record table. Commented Feb 12, 2019 at 10:11
  • 1
    you 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 tool Commented Feb 12, 2019 at 12:10

3 Answers 3

6

QGIS 3.4

  1. Make sure your polygon layer has a unique id field, such as id or fid.
  2. Run Union tool (Processing Toolbox > Vector overlay). It will return a new Union layer.
  3. 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".

enter image description here

answered Feb 12, 2019 at 12:30
1
  • Thanks very much! This works perfect and was just what i needed. Commented Feb 12, 2019 at 14:26
3

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.

answered Feb 12, 2019 at 12:31
2

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

answered Feb 12, 2019 at 12:44
3
  • when did this algorithm appear ? Commented Feb 12, 2019 at 12:52
  • don't know stumbled upon it a few days ago, when i had a similar problem. Commented 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 errors Commented Aug 10, 2020 at 2:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.