I'm trying to automatically measure the distance between 500 points in order of attribute value. So the points have the value 1 to 500 and in that order I want to measure the individual distance of all points from its predecessor.

Is there a tool or plugin to execute this analysis in QGIS?

  • Can you give the "geographical" definition of "distance from its predecessor " ... is it the closest point ? or do u have any information in your attribute table to determine the points sequence ? – snaileater May 3 '18 at 12:43
  • There is a value in the attribute table with the route of the points where the first point is 1 and the last 500 – Geo Media and design May 3 '18 at 12:46
  • @GeoMediaanddesign - Do the attribute values match the order the points were created? I.e. the 100th point added has the value 100? – Joseph May 3 '18 at 12:47
  • Yes the 100th point has the value of point 100 – Geo Media and design May 3 '18 at 12:48
  • @GeoMediaanddesign - There is a script mentioned in this post which creates lines between points (with respect to their creation id). You could then use the Field Calculator on this line layer to calculate the distance of each line. – Joseph May 3 '18 at 12:58

I don't think there is a plugin for that. But with a little sql, you can calculate it.

If predecessor is defined by their id, then you can execute following code in the databasemanager:

a. id, 
b. id predecessor,
st_distance(a.geometry, b.geometry) distance
from fictief_point a 
left join fictief_point b on a.id-1 = b.id

Go to Database > DB manager > DB manager. Navigate to QGIS layers and select your layer.

Open an sql-window and paste above code. Change 'fictief_point' twice to your layer name.

enter image description here

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.