In my script I need to check, whether a point I created stored in a memory layer lies on a polyline, which is in another memory layer. I am certain, that the point does overlap/intersect the line, because I can see it on my canvas and have coordinates (CRS do match) printed by the script. I tried point.intersects(line) but to no great success - sometimes it works, sometimes it doesn't. What function/method would you recommend to check for overlap of point and line, which would return a boolean and not result in any output layers?

  • 1
    You can adapt this script Determine if shapely point is within a linestring/multilinestring – gene Apr 5 '16 at 20:08
  • Works like 24-carat gold. Could you post it as an answer, so I can credit it properly? I have combed almost whole of the internet looking for an answer, that would relate to QGIS and didn't found this link, I think it would be helpful for others doing such intersections in qgis. – Julian_P Apr 5 '16 at 21:15
  • I was thinking that QGIS must have a "Distance within" function like postgis.net/docs/ST_DWithin.html but perhaps it does not. – user30184 Apr 5 '16 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.