2

I have set up about 45 camera traps for monitoring hares. The GPS-positions of those are shown in a point layer in QGIS. Based on satellite images, I digitized a map of the research area, with all the fields, streets, villages and so on. Basically, I have a complete map of my research area. I record the type of vegetation and its estimated height in the research area on a weekly basis and add this data to my map.

Every polygon of the map has a unique ID. For every polygon, I have landuse categories on three levels (1E, 2E, 3E in the table below), with every level getting more detailed, as well as the estimated height of the vegetation (H) and the height as a categorie (HK). These values exist for multiple weeks and are entered in one line of the attribute table, as indicated by the suffix "week1" or "week2". The data looks like this:

ID  1E_week1    2E_week1    3E_week1  H_week1  HK_week1  1E_week2     2E_week2  (...)

1   field       stubble     corn      20-30    low       field        black fallow
                field       stubble

2   settlement  settlement  village   0        none      settlement   settlement

I would now like to calculate the minimal distance from my camera positions (points) to every landuse categorie of level 2 (2E) for every week. The number of categories in 2E will be something between 15 and 20. My desired output would be something like the table below:

cameraID   landuse_type   minimal_distance[m]
Cam_1      stubble field  20
Cam_1      settlement     220
Cam_1      fallow         96
Cam_2      stubble field  0
Cam_2      settlement     150
Cam_2      fallow         72

I already tried to make this work using NNJoin-Plugin and GRASS function v.distance, but I don't get any useful results from this.

With NNJoin, I can only calculate the distance from the camera traps to the nearest polygon, which gives me only 45 results (Input layer: Camera trap positions, Join layer: Map of research area). These distances are all 0, because every camera trap is located inside a polygon. If I change input and join layer, the plugin calculates which camera trap is the nearest to every single polygon. This is also not helpful.

Using v.distance, I don't get any distances with the camera traps as "from" and the map as "to". The output is just the attribute table of the camera traps. I left maximum and minimum distance at -1, and set "upload" to dist. Maybe I am using the function wrong, I have difficulties understanding the exact operating mode of the function.

I hope someone can give me advice.

  • Welcome to GIS.SE! Could you specify what you mean by "I don't get any useful results"? – Erik Oct 17 '18 at 15:37
  • Hey Erik, thank you. See my edit. I hope this clarifies things, – Matthias Oct 17 '18 at 15:58
0

Okay, my approach would be to create centroids for all of your polygons and then build a distance matrix between the centroids and your traps. Problem with this approach is, that you don't get the distance between trap and polygon.

Or you could split your polygon layer based on your landuse types and then use v.distance.

  • I thought about the distance matrix too, I would perhaps try to densify if needed and convert the polygon's vertices to points beforehand for better results, but depending on the amount of points that it generates, it could quickly get computationally intensive. – FSimardGIS Oct 18 '18 at 0:54
  • First thank you both for your tips. The problem with centroids is, as you indicated, that I don't get the minimal distance between trap and field. As I have fields with up to 16 hectares (160.000 sqm), this would pose some significant differences. Same with the vertices, which @FSimardGIS suggested. They don't neccessary display the least distance. I also thought about your second tip, and this will be most likely my emergency solution, but as I need to do this for every single week (the landuse changes rapidly), and I'm gonna get 4 to 6 months of data, this would be a huge workload. – Matthias Oct 18 '18 at 7:16
  • Different approach: If you are somewhat familiar with SQL, you could create a virtual layer, which gives you exactly the information you desire. Currently I don't have the time to rummage in my meagre knowledge and piece together the correct syntax, sorry. Or you could resort to a python script. – Erik Oct 18 '18 at 12:04
  • I'll try looking into the matter. I'm not really used to python or SQL, but maybe I can manage something. Thank you very much for your help. – Matthias Oct 19 '18 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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