3

I am using QGIS 1.8.0 (using older version because I need the Qmarxan plugin which is not available for 2.4.0). I have a study area that has a vector laying of "planning units", or cells over the top (several thousand cells). Each planning unit has an individual ID and a couple of other fields in the attribute table. I then have a vector point layer with 8 points (ranger stations).

I need to calculate the distances from the centre of every cell to the nearest point, and have this as a new column in the attribute table. Later, I will need to do the same calculation but from the centre of each cell to the nearest road.

1 Answer 1

4

If I understand your question correctly, you can achieve this by using the Distance to nearest hub function via Processing Toolbox. Select the required options (first image), and choose what measurement you want the distance to be calculated in which will be added into a new column. You can repeat this step to then calculate the centre of each cell to the nearest road (second image).

Hope this helps!

Distance to nearest hub

Distance to nearest hub analysis

2
  • Thanks Joseph - that worked perfectly for calculating the distance from the centre of each cell to the ranger stations. I tried it with the roads however, and its not working as well (the lines are being drawn to areas with no road!) But I think that is a problem with my shapefiles, not the method. If I figure out what going wrong I'll leave another comment Sep 2, 2014 at 10:33
  • Glad something worked! You could try using Vector > Geometry Tools > Check geometry validity. This may help show you if there are errors somewhere.
    – Joseph
    Sep 2, 2014 at 10:37

Your Answer

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

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