Re: [R-sig-Geo] calculate raster values based on vector regions

2009-01-28 Thread Kamran Safi
Hi Herry, I am not entirely sure I understand your problem, but I suggest to do the following: 1st alternative 1. load your shape files 2. set the bounding box of the polygon to match your grid scheme 3. use spsample() to sample the polygon in a regular fashion 4. assign to those points that

Re: [R-sig-Geo] Eigenvalues for eigenvectors extracted using ME() of spdep

2009-01-28 Thread Roger Bivand
On Wed, 28 Jan 2009, Xingli Giam wrote: Hi everyone, I hope someone can point me to the right direction in printing the eigenvalues of selected eigenvectors using ME() of spdep. I've communicated with Dr. Pedro Peres-Neto and he has been really helpful in answering some of my questions about

Re: [R-sig-Geo] calculate raster values based on vector regions

2009-01-28 Thread Tomislav Hengl
Dear Herry, If I understand what you problem, one solution is to use R+SAGA. You should first convert the polygon map to the same grid, and then you can load it to R and do any type of aggregation: library(maptools) library(rgdal) library(RSAGA) # load the gridded map: rastermap -

Re: [R-sig-Geo] calculate raster values based on vector regions

2009-01-28 Thread Alexander.Herr
Hi list, I try to explain my problem a bit better. 1) Vector and raster have the same extent. 2) Vector data: Several polygones with different attribute values 3) raster data: A raster with points over the areas (and also NAs for areas where it is not possible to have a value from polygones).

Re: [R-sig-Geo] calculate raster values based on vector regions

2009-01-28 Thread Tomislav Hengl
My appologies. The previous script had few (5) typos: library(rgdal) library(RSAGA) # load the gridded map: rastermap - readGDAL(rastermap.asc) rsaga.esri.to.sgrd(in.grids= rastermap.asc, out.sgrds= rastermap.sgrd, in.path=getwd()) # convert the polygon map to a raster map: cellsize -

Re: [R-sig-Geo] calculate raster values based on vector regions

2009-01-28 Thread Kamran Safi
Hi Herry, ok I think this should be pretty simple. you should be able to do that with overlay(). Just use your raster and overlay it with every polygon (in which the value is its ID) singly. If you use a loop (for n in your.p...@plotorder) and overlay(raster,

Re: [R-sig-Geo] reading *.grd files - revisited

2009-01-28 Thread Monica Pisica
Hi Robert, Thank you so much for your help. It works very nicely i wonder why the extension was grd nowhere on the site from where i downloaded the data it said it is a netCDF file Monica Date: Wed, 28 Jan 2009 09:58:23 +0800 Subject: Re: [R-sig-Geo] reading *.grd files

Re: [R-sig-Geo] calculate raster values based on vector regions

2009-01-28 Thread Edzer Pebesma
Alexander, below is a reproducible example that uses a polygon data set from package maptools. You should read your polygons e.g. through readOGR (package rgdal) and your grid through readGDAL. If your grid comes from readGDAL, then 2 and 3 can be omitted, and 5 simplifies to: out$SID79 =

Re: [R-sig-Geo] calculate raster values based on vector regions

2009-01-28 Thread Alexander.Herr
Thanks Edzer, That would do it. Unfortunately I can't read the (ESRI) grid, it is too large: raster1 has GDAL driver AIG and has 73772 rows and 80264 columns Error in array(dim = as.integer(c(rev(output.dim), length(band : 'dim' specifies too large an array I 'll have to cut into

[R-sig-Geo] memory issue on R with Linux 64

2009-01-28 Thread Alexander.Herr
Hi List, I get an error using readGDAL{rgdal}: cannot allocate vector of size 3.1 Gb I am using Linux 64bit (opensuse 11) with 4 gig swap and 4 gig Ram and R 2.8.0. The load monitor shows that most of Ram is used up and then when Swap use starts increasing, R returns the error. Is there

[R-sig-Geo] How to evaluate cross-validaiton of interpolation?

2009-01-28 Thread Yong Li
Hi ALL, I have done a number of interpolations using kriging and idw with gstat, and use krige.cv to produce the cross-validation (nfold=5) as well. How can I evaluate the results of cross-validation for individual variables based on the me, mspe, rmse, Mean square normalized error, r

Re: [R-sig-Geo] memory issue on R with Linux 64

2009-01-28 Thread Edzer Pebesma
Well, this doesn't come as a surprise; if it did for you then you didn't read the list archives well. R has been designed for analysing statistical data, which usually doesn't outnumber billions of observations, and not for analysis/processing of large grids/imagery. rgdal has

Re: [R-sig-Geo] memory issue on R with Linux 64

2009-01-28 Thread Roger Bivand
On Thu, 29 Jan 2009, alexander.h...@csiro.au wrote: Hi List, I get an error using readGDAL{rgdal}: cannot allocate vector of size 3.1 Gb This is a tile of your 73K by 80K raster, right? One possibility is to use smaller tiles, another to get more memory (as Edzer wrote), a third to use