I'm trying to figure out a way to plot points along a polyline at distances that I have in a .csv file (not a point layer with valid lat/long).
There seem to be quite a few ways to create points along a line:
- Creating points along line according to attribute data using QGIS?
- Creating points in specified distance along line using QGIS?
However, I have not been able to figure out a way based on a given value.
Here is an example of what I am trying to accomplish with this csv data:
Best Answer
It's kind of easy to do with a python script that you can run from the editor of the Qgis console.
First, you need to get your line layer and get the feature inside. Then, you need to loop on your csvfile to get the distance and create the point with the
interpolate
method of QgsGeometry. Finally, add the created point to a new point layer.The following do the trick, you just need to replace the values in the firsts lines (line_layer, csvfilepath, EPSG) to fit to your data:
the new layer is added to your map canvas as a memory layer containing the needed points and the csv data in corresponding fields.