Therefore there is a quicker solution iterating through the segments of the
line until a segment contains the point
The Spatial predicate is *point.within(line)* but as there are floating
point precision errors when finding a point on a line, I use the distance
with an appropriate threshold.
def
It is a pure problem of analytical geometry or vector calculus (look at
PyQGIS: geometry, vectors, vector algebra or direction cosines...(in French
http://www.portailsig.org/content/pyqgis-des-geometries-des-vecteurs-de-l-algebre-vectorielle-ou-des-cosinus-directeurs
))
Is the line is straight
Dear Gene,
Maybe my have not been well explained but I don't need the straight
cartesian distance but the distance following the line (as a path).
I think the code posted by Giovanni should be fine for my case.
I will test it right now.
Thanks
Pierluigi
Il giorno mer, 14/01/2015 alle 00.05
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
https://gist.github.com/giohappy/f2abde1549aa2775b5aa
2015-01-14 10:40 GMT+01:00 gene martin.lal...@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
Yes gene. Plus, this script considers a point not intersecting the line.
2015-01-14 10:49 GMT+01:00 gene martin.lal...@gmail.com:
= sum of segments length before the one where the intersecting point lies +
the length between the first point of this segment and the intersection
point
--
= sum of segments length before the one where the intersecting point lies +
the length between the first point of this segment and the intersection
point
--
View this message in context:
Hi Pierluigi,
I don't know of such a function available from Python. I've translated a
function from GEOS (C++) to Python some time ago. If you wish I can share
it.
giovanni
2015-01-13 18:16 GMT+01:00 Ing. Pierluigi De Rosa
pierluigi.der...@gfosservices.it:
Hi all,
I have a line geometry
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