3

I am totally new to QGIS and I have a List of Trackpoints which I loaded in QGIS as a CSV (with the GEOCSV plugin to be able to edit the layer).So I have a Layer with ~1000 Points now.

I like to add a column "distance" in the table of attributes with the distance from the previous point. The Distance should be calculated using latitide and longitude.

mgri
  • 16,159
  • 6
  • 47
  • 80
Maike
  • 31
  • 1
  • 2
    Here is an answer for the use in a spreadsheet program like excel or libreoffice if this is an option. https://gis.stackexchange.com/a/76282/69528 – Matte Jul 02 '17 at 16:24

1 Answers1

2

QGIS 3.0

If you are working on a Points layer which is on UTM zone 54N (EPSG:32654), then try:

distance(transform(geometry(get_feature_by_id('Points', $id+1)),'EPSG:4326','EPSG:32654'), 
         transform(geometry(get_feature_by_id('Points',   $id)),'EPSG:4326','EPSG:32654'))

Please edit 'Points' (layer name) and 'EPSG:32654' (your working CRS) as required.

Kazuhito
  • 30,746
  • 5
  • 69
  • 149