I wrote a python plugin that grabs all (vector, linestring) features between two points on the map. At the moment, I select all features intersecting the rectangle around these two points, and then use shapely to filter out features not actually intersecting the line between the two points. This is inefficient, and I'm wondering if there is a way to perform the correct operation directly in QGIS (regardless of the data-source backing the layer)?

  • i.e. if I were working directly with PostGIS, I would use a query something like: SELECT c.elevation FROM contour_layer AS c WHERE ST_Intersects(LineString(Point 1, Point 2), c.geometry); Just wondering if qgis can be smart enough to do this? I guess the alternative (since my data-source IS postgis) is to write the optimised approach, and use it only when I detect the data-source as postgis. – James Fysh Apr 14 '15 at 22:52

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.