[QGIS-Developer] Does Polyline.intersects(Point) work in QGIS master?

Nyall Dawson nyall.dawson at gmail.com
Wed Nov 29 14:56:18 PST 2017


On 29 November 2017 at 02:22, Germán Carrillo <carrillo.german at gmail.com> wrote:
>
> Hi devs,
>
>
> do you know why this polyline
>
> >>> my_line = QgsGeometry().fromWkt('0 0, 963461.42999999970197678 1077875.79199999943375587, 1 1')
>
> and this point
>
> >>> my_point = QgsGeometry().fromWkt("Point (963461.430 1077875.792)")
>
> don't intersect?
>
> >>> my_line.intersects(my_point) # returns False
>

Because we use the GEOS library to test intersects, and it performs an
exact intersection test. So 963461.42999999970197678
1077875.79199999943375587 is not the same as 963461.430 1077875.792.

This is the same behaviour in 2.x, and all other GEOS based projects
(e.g. PostGIS gives the same result).

Nyall


More information about the QGIS-Developer mailing list