0

I have distribution data of a set of species (plants, mosses and lichens: 13 species total) in the Netherlands. I made a grid that divides the Netherlands into 1x1 km squares. I am not interested in how many points of a single species are within a square. I used the TomBio addon to transform the species point data into 1x1 km squares, so that they match the grid (i.e. ten points of a species in a gridcell are now one 1x1 km square. Also, one species in a gridcell is now a 1x1 km square).

I want to make an estimate of the distribution of the community these species occur in. Every species has a weighing value related to how much they are bound to the community i want to estimate the distribution of. This means that some species that do occur in the community, but also occur in other communities get a value of 1. Species that occur solely in this community get a value of 10. Of course this is different for each of the 13 species.

Based on the weighing values, i determined a threshold value. i.e, if the sum of weighing values (determined by the species that occur) within a grid cell exceed this threshold, i can assume that the community occurs in that gridcell.

To make the whole story a bit more comprehensible:

Species      Weighing value 
A            2       
B            4
C            6
D            6
E            10

If the sum of the values in a grid is say twelve or more, I assume the community is present there. See below for a heads example of the attribute tables.

How can I use QGIS to calcuate within a gridcell the value of the sum of the appointed weighing values, and if the threshold is exceeded, the gridcell gets a color?

I know how to count the individual blocks (species) in a gridcell, but I havn't worked out a way to include the weighing values in this process.

attribute table example

4
  • So each gridcell has attribute table fields, with the count of each species in that cell?
    – csk
    Commented Nov 2, 2019 at 20:40
  • Yes, thats true. Each grid cell is a seperate polygon if you will. So i can count the numer of points in it, but not the the sum of the values connected to that point. Commented Nov 2, 2019 at 20:41
  • 2
    I'm not sure I entirely understand your data structure. Can you add a screenshot of each attribute table to your question? I don't need to see the entire table, just the names of the columns and a couple lines of data in each table.
    – csk
    Commented Nov 2, 2019 at 20:46
  • I added it in the main question. I also added a short picture of the 1x1 km grid. Species are from the excel list since qgis keeps crashing when i start the TomBio addon... Commented Nov 3, 2019 at 15:18

1 Answer 1

2

Use the Field Calculator to add an integer field called "present" with this expression:

"species_ct_A"*"value_A" + "species_ct_B"*"value_B" + "species_ct_C"*"value_C" + "species_ct_D"*"value_D" = 12

This expression will evaluate to either "true" (1) or "false" (0). Cells that meet the threshold value of 12 in the above example will have a "present" value of 1. Cells that don't meet the threshold value will have a "present" value of 0.

If you want cells that meet the threshold value to have a different fill color than cells that don't meet the threshold value, use a categorized style to symbolize the grid layer.


I still don't entirely understand your data setup, so this is a generic solution using placeholder field names. You will need to substitute the actual field names from your data for the placeholders.

Species Count and Weighting Values: The placeholder field name "species_ct_A" represents the counted number of species A in each grid cell. The placeholder "value_A" represents the weighing value for species A. Each species has corresponding fields. I assumed that these values are attribute table fields in the grid layer. If they are fields in a different layer, you'll need to retrieve them from that layer. The easiest way to retrieve those values would be to join the other layer to the main grid layer.

  • If both grid layers have a shared unique ID value, you can do a regular table join. (Layer properties > Joins).
  • If they don't, do a spatial join with the join attributes by location algorithm (Vector menu > Data management), with the geometry predicate equals.

Threshold value: I used a threshold value of 12, as in your example. You can substitute any numerical value here, or a field name if the threshold values are stored in that field.

1
  • This works for me. Thanks a lot! Commented Nov 5, 2019 at 19:32

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.