Tag Info

New answers tagged

5

You need to use a spatial index. Without an spatial index, you must iterate through all the geometries. With a bounding spatial index, you iterate only through the geometries which have a chance to intersect the other geometries. Popular bounding spatial index in Python: R-tree index (Python modules Rtree or pyrtree) Quadtree index (Quadtree module) ...


2

When it comes to optimizing code, don't guess - profile http://stackoverflow.com/questions/582336/how-can-you-profile-a-python-script. Just looking at your code, a similar statements : avail_area = pt_buffer.intersection(sa).area seems like it would get called even more than the statement you identified, since it's nested in yet another loop. Also, you ...



Top 50 recent answers are included