Fastest function to find the intersect between a line and polygon edges?

Discussion created by ansergis on Jan 10, 2012
Latest reply on May 14, 2013 by nazereh

I have a script which identifies the locations of intersects between n-polygon boundaries and a line (a vector) using shape files without any spatial index.

At present it generates a polyline and uses a spatial filter to identify the relevant polygons, then loops through the vertices of each to find the intersection points. It is rather slow as it has to be repeated thousands of times. Implementing a spatial index will be lengthy as it will mean recoding all the references to shp files to access a gdb throughout the software and as I didn't write it I'd rather restrict my tinkering to the one, easily restored, class.

My question is what alterative functions users might suggest that could be quicker. I am considering afew :

iRay to identify the interesect points Or LocateFeaturesAlongRoutes_lr?
Or convert everything to lines and clip to a buffer of the vector first before doing intersect testing..

I am sure there are otherways to skin the cat, but which is likely to see a time saving?

Any suggestions or references to a good source of explainations about the algorithms behind the classes would be welcome also, for example I assume spatial filter deploys some sort of prior minimum bounding geometry test but I'd like to know for sure.

Thanks for your time,