4

I start by drawing polygons by hand and assigning each polygon an attribute value for a frequency (or probability). What I then need is to create a heat map or iso-contours that show the cumulative probability at each point (that is covered by one or more polygons). The scale of these contours should be logarithmic.

I've been trying to play around with the polygons that I create, using the Union function and Centroids, but I can't figure out how to get the overlaps to sum all the values of this specific attribute, and produce a visualization of that data. Where do I start?

Below is an example of what the data may look like, and what type of end-result graph I'd like to produce. ( The actual numbers in the example don't add up correctly...)

enter image description here

1 Answer 1

4

Let's assume there is a polygon layer called 'test' (blue polygons).

input

Step 1. Apply the "Union" geoalgorithm

step_1

Step 2. "Delete duplicate geometries"

Step 3. Convert "Multipart to singleparts"

Step 4. In the "Field Calculator" use the following expression (with overlay_intersects() function):

array_sum(overlay_intersects('test', "Value"))

to sum all the values of the "Value" attribute

step_3

Step 5. Get the "Centroids"

step_5

Step 6. "Extract vertices" from the polygons achieved at the step 3

step_6

Step 7. "Merge" the results of steps 5 and 6

step_7

Step 8. Proceed with the "Contour" Plugin to generate contours for the "NewValue" field, to get the following result

result

5
  • Thank so much for the response! Unfortunately, I end up with some error in Step 3 - the resulting table either end up with NULL values in the new field ("NewValue"), or I get values that don't add up correctly as yours do in the example. What "number type" should I choose for the Field "Value"? Length and precision? I end up with different results when I play around with there, but never correct...
    – HenrikM
    Nov 14, 2022 at 11:55
  • I used Real data type for "Value" and "NewValue" fields
    – Taras
    Nov 14, 2022 at 11:57
  • When I create a new ShapeFile layer, I can only choose: Text(String), Integer (32bit), Decimal(Double) or Date - for NewField/Type. I must do something wrong. Your table shown in Step 3: for me, all (7) rows end up with NewValue=0.111
    – HenrikM
    Nov 14, 2022 at 14:09
  • Try the Decimal(Double). Is it possible to share your data?
    – Taras
    Nov 14, 2022 at 15:10
  • Thanks again for your resonses! I ended up solving my needs by using the first method in this post: gis.stackexchange.com/questions/210959/… - the one for QGIS 3.2, and then playing around with layer styles, logarithmic intervals for coloring - producing a nice enough map.
    – HenrikM
    Nov 15, 2022 at 9:47

Your Answer

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

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