[R-sig-Geo] Optimizing spatial query in R

2017-02-20 Thread Ervan Rutishauser
Dear All, I am desperately trying to fasten my algorithm to estimate the fraction of tree crown that overlap a given 10x10 subplot in a forest plot. I have combined a set of spatial functions (gDistance, extract) & objects (SpatialGrid, SpatialPolygons) in a way that is probably not the most effi

Re: [R-sig-Geo] Optimizing spatial query in R

2017-02-20 Thread Chris Reudenbach
Ervan, Just on the run, especially if you deal with real data and some 100K -1000K of vectors I think the fastest way to do so is to engage GDAL GRASS7/SAGA and their ability to deal highly efficient with this kind of topological and geometrical queries. A very good pure R alternative is to

Re: [R-sig-Geo] Optimizing spatial query in R

2017-02-20 Thread Ervan Rutishauser
Dear Chris, Thanks for your prompt reply and pointing out the "sf" package . I wasn't aware of it, but I am glad to see it has been released only 2 weeks ago ;) I'll have a look right now. Tschüss Ervan On 20 February 2017 at 10:56, Chris Reudenbach wrote: > Ervan, > > Just on the run, especia

Re: [R-sig-Geo] Optimizing spatial query in R

2017-02-20 Thread Roman Luštrik
The biggest bottleneck was creating a SpatialPolygons object and calculating gDistance. After computing the SP object outside the for loop, the run time came down dramatically (see SO post). Cheers, Roman On Mon, Feb 20, 2017 at 10:56 AM, Chris Reudenbach < reudenb...@uni-marburg.de> wrote: > Er

Re: [R-sig-Geo] Optimizing spatial query in R

2017-02-20 Thread Tim Keitt
I generally use postgis for this sort of thing. THK http://www.keittlab.org/ On Mon, Feb 20, 2017 at 2:45 AM, Ervan Rutishauser wrote: > Dear All, > > I am desperately trying to fasten my algorithm to estimate the fraction of > tree crown that overlap a given 10x10 subplot in a forest plot. I