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

G. Allegri giohappy at gmail.com
Wed Jan 14 01:42:45 PST 2015


https://gist.github.com/giohappy/f2abde1549aa2775b5aa

2015-01-14 10:40 GMT+01:00 gene <martin.laloux at gmail.com>:

> 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.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Giovanni Allegri
http://about.me/giovanniallegri
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150114/5d333cea/attachment.html>


More information about the Qgis-developer mailing list