Skip to content
Prev 14345 / 29559 Next

speed problem with %over% function

For this example at least you are severely handicapping rgeos as gIntersect needs to create all new points that result from the intersections which then need to be translated back to R from the geos representation. If you use something like the following you should see much better results:
user  system elapsed 
  0.365   0.008   0.371
In this case I am using a spatial predicate instead of a topology operator, also note that I've switched the order of the polygon and the points since some of the predicates can make use of prepared geometries to improve performance and rgeos assumes the first geometry should be the prepared geometry (think in terms of the fact that you are comparing a bunch of points to one polygon so prepare the polygon (create a spatial index) to improve performance).  

-Colin

-----

Colin Rundel
Visiting Instructor
Duke University, Department of Statistical Science
colin.rundel at stat.duke.edu
www.stat.duke.edu/~cr173/
On Feb 29, 2012, at 11:19 AM, <Bastien.Ferland-Raymond at mrnf.gouv.qc.ca> <Bastien.Ferland-Raymond at mrnf.gouv.qc.ca> wrote: