[Qgis-developer] calculate distance from two points along line in pyqgis

gene martin.laloux at gmail.com
Wed Jan 14 01:40:28 PST 2015


I don't have the code posted by Giovanni but this is very easy to do with 
Shapely <http://toblerity.org/shapely/manual.html>   (a Python wrapper of
GEOS).

With PyQGIS, I do it in this way:

1) by definition a polyline is composed of  straight  segments between
points (nodes)
2) after computing the intersection between the polylines , the intersecting
point lies on a particular segment, easy to determine.
3) Then a simple loop through the segments (length) allows to compute the
distance between the first point of the line and the intersection point (=
sum of segments length + the length of the segment between the first point
of the segment where the intersecting point lies and the intersection
point).



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/calculate-distance-from-two-points-along-line-in-pyqgis-tp5181313p5181413.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list