Skip to content
Prev 2935 / 29559 Next

point.in.polygon() on massive datasets

On Thu, 13 Dec 2007, Roger Bivand wrote:

            
A fix using polygon bounding box pre-selection of points is on r-spatial 
CVS.

For Markus' problem, it should help a good deal - for larger numbers of 
points I'm seeing over an order of magnitude speedups (100,000 point on 
100 polygons on an older box in about 10 seconds, about 100 on a much 
faster box). I'd take 5M point chunks, possibly by subsetting the points 
spatially.

For Ingo's problem (many polygons), it may help directly, or perhaps 
taking subsets of polygons may still be needed. It still has to loop over 
the list of polygons, there is no easy way round this. An alternative 
might be using nearest neighbours to polygon centroids

Until this is tried out, the checkout is for a CVS copy of the source:

http://sourceforge.net/cvs/?group_id=84357, modulename sp

If you'd like a copy of the draft package as a source tarball or Windows 
binary, please let me know, because this need to be compared against the 
actual problems before it is released.

Roger