7

I have a line layer (representing a pipeline) and a points layer (representing valves) and I would like to calculate the chainage of the valves along the pipeline.

I assume that I would first need to 'snap' the points to the line in order to calculate chainage as they do not currently lie directly above the line. However I would need to use a bulk tool if possible as there are several hundred points and would take too long to do manually.

I wondered whether the LRS tool in QGIS could be used to derive chainage? If anyone has documentation or a guide to using the tool I would appreciate it.

I am using QGIS 2.2, GRASS & Postgis.

  • 1
    I deleted my answer. This is not easy to do in QGIS. Here is a lead - gis.stackexchange.com/questions/59169/… – Willy Mar 4 '14 at 11:40
  • Also v.distance from the processing toolbox but I can't get it to run on my machine. – Willy Mar 4 '14 at 11:44
  • 1
    Dont know any easy way to do it in QGIS but there is allways PostGIS (still free) but you need some SQL. Add valve table 2 columns on_pipe_geom and distance_to_start. DistanceToStart is ST_LocatePoint(linegeom, ST_closestpoint(linegeom, valvegeom)) and on_pipe_geom is ST_closestpoint(linegeom, valvegeom). If data is not that good then you need find that linegeom finding closest linegeom for every point ( and add nearest_pipe_id column for your valve table) – simplexio Mar 4 '14 at 14:36
  • Im sorry I haven't had much experience with performing geospatial analysis in Postgis. Would you be able to provide more clarification? – Canningmister Mar 4 '14 at 14:40
3

You can use the QGIS plugin LRS for that. It accepts points not lying on the line, so you avoid the first step (snapping points to lines).

This is the workflow:

  1. Based on both a line (routes) and a point (for calibration) layer, go to the Calibration tab.

    • Select the line (pipeline) layer with its route field (a field that identifies routes, it's very useful if your line layer has several routes).
    • Select the calibration point layer with its corresponding route (point route value should match with the line route value) and measure fields. As you can see, you would need a calibration point layer with at least two points, which could be located at the start and the end of the route, with values of 0 and 10000 in case that the route has 10km.

    enter image description here

    • Click on Ok to interpolate M values along the routes.
  2. Go to the Measures tab.

    • Select your valves layer.
    • Fill the output fields (They'll be applied to a new layer, don't worry).
    • Click on Ok to get a new (memory) layer which will contain the M value (chainage) of each valve.
  3. Don't forget to save the layer you obtain from 2., since it's a memory (temporal) layer.


In the following screenshot you can see a sample pipeline, a couple of calibration points (orange triangles), and a couple of valves not lying on the pipeline (green points) with their calculated chainage (M value).

enter image description here

You can even verify the chainage of the valves by using the Locate tab. Just select your route and enter a known measure (e.g., 5603). You should see a yellow mark on the line, representing the projection of the valve on the line.

enter image description here

I use QGIS v.2.6.1. You can find documentation of LRS plugin here.

0

GRASS GIS offers a lot of network tools out of the box, which include also snapping of nodes to edges...

Detailed tutorials can be found here: https://grass.osgeo.org/grass72/manuals/vectorintro.html#vector-network-analysis and here https://grasswiki.osgeo.org/wiki/Vector_network_analysis

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.