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:
reader = csv.reader(f)
next(reader)
for row in reader:
dist=int(row[0])
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.