Plotting points along line with specified distances from start using QGIS?

I have a table with distances in a line in meters.

Distance
---------
3110
3120
3145
...

I need to create points along this line in the distance from the start, as specified, using QGIS.

My doubt is similar to this Plot points along a line at specific distance value?, but the PyQGIS code didn't work.

• Welcome to GIS SE! As a new user be sure to take the Tour to learn about the site and its protocols. By asking how to do the same thing in either of two products you are effectively asking two questions which makes this too broad. To avoid that I removed ArcMap from your question. If you wish to also ask about that then please do so in a separate question. – PolyGeo May 27 at 4:59

In QGIS2 you can do it like this:

1) open the field calculator and add a new field with \$length
2) open attribute table and copy newly created value
3) use "Create points along lines (GDAL/OGR)" with 3110/value etc. (using the \$length function instead of copying the value didn't work for me here)

If you need to automate the process, try this (QGIS2.18):

import csv
from qgis.utils import *
import processing

#paths for csv input with distances and output folder for shapefile
path_distances_csv=r'C:\Users\XXX\Desktop\pointsalonglines\distances.csv'
path_output_folder=r'C:\Users\XXX\Desktop\pointsalonglines'

#access active layer (line shape) and calculate its length
layer = iface.activeLayer()
features = layer.getFeatures()
for f in features:
geom = f.geometry()
length = geom.length()

#read csv with specified distances
list_dist=[]
with open(path_distances_csv, 'rb') as f:
for row in reader:
dist=int(row)
list_dist.append(dist)

#create points at specified distances
output_list=[]
for distance in list_dist:
output=processing.runalg("gdalogr:createpointsalonglines",layer,"geometry",distance/length,"",None)
output_list.append(output)

#create string so that points at specified distances can be merged
output_list = [str(output_list[i]["OUTPUT_LAYER"]) for i in range(len(output_list))]
output_string=";".join(output_list)

#merge points into single shapefile
processing.runalg("qgis:mergevectorlayers",str(output_string),path_output_folder+'/'+'points_merge')

The only thing you need to do is to change the paths for the csv input and output folder as well as load your line in QGIS.

I don't know an efficient way; if your distance is multiples of five (5) this approach may be an option.

(1) Create points along the line at equal interval (5 meters starting from 3110m). (2) Select points of matching distance. (either by eyeballing them or using get_feature() expressions etc.).

There is a plugin called QChainage that can do this.