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

Ing. Pierluigi De Rosa pierluigi.derosa at gfosservices.it
Tue Jan 13 09:16:50 PST 2015


Hi all,

I have a line geometry (ALine) and a point(Apoint) belonging to the
ALine.
Apoint have been evaluated from a second line geometry Bline that cross
the Aline using the QgsGeometry intersection function as:
Apoint =Bline.intersection(Aline)

I need to calculate distance along Aline from the starting point of
Aline up to Apoint.

In a certain way this problem could be seen as the opposite of function
interpolate of QgsGeometry
point = geom.interpolate(currentdistance)
where it is known the distance from the beginning and it provide the
point at specific distance.
In my case I have the point but I need the distance.

Thanks
Pierluigi
-- 

                                    
________________________________________________________________________
Ing. Pierluigi De Rosa (PhD)
Studio Associato GFOSSERVICES




More information about the Qgis-developer mailing list