[R-sig-Geo] Aspect data interpretation

2014-05-06 Thread Bea GD
Hi all, This is a bit general question. I've searched the web but I haven't gotten a consistent answer. I've used a digital elevation model to produce another raster with aspect data by using 'terrain{rater}'. Aspect data ranges from 0 to 360 degrees. In the vignette of the raster package

Re: [R-sig-Geo] 3rd+ rasters added using plot(r, add=TRUE) are misregistered

2013-12-05 Thread GD
Good catch. I have no solution -- but I get the same problem on an earlier version of R in a different environment (so it is not just because of your setup). My session info is below. Cheers, Gareth. sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-unknown-linux-gnu (64-bit)

Re: [R-sig-Geo] How extract multiple points from a buffer created from the same points?

2013-12-01 Thread GD
I'm not 100% sure what you mean -- but it sounds like could try running 'spDists' on the tree's coordinates, which will return a distance matrix for the trees (i.e. all pairwise distances). Then for each row, you could find the indices which are your distance threshold -- this should tell you the

Re: [R-sig-Geo] How extract multiple points from a buffer created from the same points?

2013-12-01 Thread GD
Try this library(sp) # Hypothetical point coordinates -- 20 points in total, in a 'unit box' mycoords=cbind(runif(20),runif(20)) # Chosen distance threshold for 'neighbours' mythresh=0.2 # Distance matrix myDists=spDists(mycoords) # Compute neighbours -- store result in a list # NOTE: All

Re: [R-sig-Geo] Long time to load shapefiles

2013-10-16 Thread GD
Hi Phil, I have also found readOGR to be very slow when reading a large shapefile (in my case, a shapefile with 85000 polygons and ~ 200 columns in the attribute table). In my case, I would repeatedly re-read the shapefile each time I was working on the script. To speed things up, I found it

Re: [R-sig-Geo] Error message in calc()

2013-10-07 Thread GD
For RasterLayer objects, I think you need to use 'maxValue' and 'minValue' instead of max and min -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Error-message-in-calc-tp7584795p7584796.html Sent from the R-sig-geo mailing list archive at Nabble.com.

Re: [R-sig-Geo] Error message in calc()

2013-10-07 Thread GD
Apologies the last suggestion was totally wrong, since 'calc' applies the function to each cell (represented as a vector). However, the problem might be that the 'which' function inside your 'fun1' is sometimes returning more than one value. In that case, you might try forcing 'w' to have the

Re: [R-sig-Geo] How to plot great circles on a Robinson projection map in ggplot2?

2013-09-20 Thread GD
I think that is covered in this question (?): http://gis.stackexchange.com/questions/44387/use-proj4-to-specify-robinson-projection-with-r-ggmap-and-ggplot2-packages -- View this message in context:

Re: [R-sig-Geo] making an inset in a map figure

2013-09-12 Thread GD
# Something like library(maptools) data(wrld_simpl) plot(wrld_simpl,border=NA,col='blue',axes=T, xlim=c(100,130), ylim=c(-40,30)) par(plt = c(0.2, 0.5, 0.6, 0.8), new = TRUE) plot(wrld_simpl,border=NA,col='green',bg='white',axes=F) # If you put axes on the inset, they will fall over the

Re: [R-sig-Geo] Extract function - too much data for R?

2013-08-30 Thread GD
I had related situation with 85000 non-overlapping polygons, and a raster dataset with dimensions ~ 1x1. In that case I wanted the full distribution of pixel values inside each polygon, rather than just the mean. An efficient approach (much faster than extract) was: 1) Rasterize the