Finding polygons crossed by line using OGR?

For a Python solution, you may want to look at Shapely http://gispython.org/shapely/docs/1.2/ and RTree http://pypi.python.org/pypi/Rtree/

Rtree will help you create spatial indexes.


Instead of expansive intersect, you can perform pre-selection of polygons based on comparison of bounding boxes. In other words, find all polygons overlapped / adjacent to MBR of segments of your track. Then perform detailed test on the subset of polygons.


The proposals of mloskot and Nicklas to compare the bounding boxes are indeed correct.

If you are using shapefiles you could also consider calling this saga module: http://www.saga-gis.org/saga_modules_doc/shapes_transect/index.html