2

I am trying to measure the distance of each bus stop along a number of different bus routes. The data source is OSM routes and stops, subsequently saved as shapefiles within QGIS. CRS is EPSG:27700 - OSGB36 / British National Grid so I can measure in metres.

Based on the answer to (Points layer distance from the start of line layer in QGIS), I have been using a calculated field with the following formula: line_locate_point(geometry:=geometry(get_feature('[RouteLayer]','[RouteID]',"[RouteID]")),point:=$geometry)

...and this seemed to work OK. However upon closer inspection I have spotted that some distances are out of sequence (i.e. the 6th point measured as being further along the route at 2375m than the 7th at 2108m) This happens at further points along the line too...the points highlighted in the image for one particular route stand out as obvious errors. enter image description here I've checked the validity of the route layer and this returns no errors.

Can anyone suggest what else I can try to understand the cause of the problem and how I might resolve it?

Ultimately I'll be doing this analysis on hundreds of bus routes so manually checking/correcting each one will not be feasible.

EDIT: I've determined the problem is caused by the direction of line digitisation being inconsistent along my route.

My route is a multiline string so I used the Vector/Geometry Tools/Multipart to Single Parts tool to divide the route up into it's individual segments. Then I added a direction marker to each segment. This showed that the segments do not all "flow" in the same direction...so I suspect that if a stop point coincided with a "reversed" segment then the measurement was taken from the wrong end of the segment. Which is why some distance points were in the wrong order. Where there were lots of small segments, the problem was masked, but where a stop occurred on a longer segment, the error was more obvious.

...now to work out how to make everything flow in the same direction!

enter image description here

2
  • Would Linear referencing in PostGIS be more precise for your bus routes network? postgis.net/workshops/postgis-intro/linear_referencing.html "Road maintenance operations, which are referenced as occurring along a road network between a pair of mile measurements."
    – Mapperz
    Commented Sep 30 at 16:31
  • I suggest you to specify the exact version of QGIS used and to provide the layer. Commented Sep 30 at 20:29

1 Answer 1

1

Provided that the line parts are spatially connected, you need to use the "Dissolve" processing algorithm in order to obtain a single line with a unique direction from the consecutive line parts having different directions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.