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

Germán Carrillo carrillo.german at gmail.com
Thu Nov 30 04:44:30 PST 2017


Thank you Nyall, that makes sense.

It would be nice to have a tolerance parameter so that this very little
discrepancies can also be found, but I guess one could snap one geometry to
the other (with such little distance as tolerance) and then run intersects.

Regards,

Germán

2017-11-29 17:56 GMT-05:00 Nyall Dawson <nyall.dawson at gmail.com>:

> 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
>



-- 
-----------
   |\__
(:>__)(
   |/
Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
http://twitter.com/GeoTux2
http://about.me/germancarrillo

<http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171130/4153f5f4/attachment.html>


More information about the QGIS-Developer mailing list