Skip to content
Prev 769 / 29559 Next

how to go from SpatialGrid to SpatialGridDataFrame ?

good, thanks...

however,  there seemed to be another problem.. of a different kind I  
fear...

I got:

 > kkp=idw(glmpred~1,data.new_alb[gd.glm,],data.grd)
Error in predict.gstat(g, newdata = newdata, block = block, nsim =  
nsim,  :
	data items in gstat object and newdata have different coordinate  
reference systems

Due to a simple space in the first coord definition... (perhaps easy  
to fix... by some string processing?)
 > rbind(proj4string(data.new_alb),proj4string(data.grd))
      [,1]
[1,] " +proj=aea +lat_1=29.75 +lat_2=45.25 +lat_0=37.5 +lon_0=-96  
+x_0=0 +y_0=0 +no_defs +a=6378137 +rf=298.257222101  
+towgs84=0.000,0.000,0.000"
[2,] "+proj=aea +lat_1=29.75 +lat_2=45.25 +lat_0=37.5 +lon_0=-96  
+x_0=0 +y_0=0 +no_defs +a=6378137 +rf=298.257222101  
+towgs84=0.000,0.000,0.000"



This was an easy problem that got solved using

 > proj4string(data.new_alb)<- CRS(proj4string(data.grd))
 > rbind(proj4string(data.new_alb),proj4string(data.grd))
      [,1]
[1,] "+proj=aea +lat_1=29.75 +lat_2=45.25 +lat_0=37.5 +lon_0=-96  
+x_0=0 +y_0=0 +no_defs +a=6378137 +rf=298.257222101  
+towgs84=0.000,0.000,0.000"
[2,] "+proj=aea +lat_1=29.75 +lat_2=45.25 +lat_0=37.5 +lon_0=-96  
+x_0=0 +y_0=0 +no_defs +a=6378137 +rf=298.257222101  
+towgs84=0.000,0.000,0.000"


Thanks Edzer!
--
Horacio Samaniego
Dept. Biology
University of New Mexico
Albuquerque 87106, NM

http://www.unm.edu/~horacio
On Feb 1, 2006, at 1:41 PM, Edzer J. Pebesma wrote:

        
Horacio Samaniego wrote:

            
Yes; sorry it took me a while to recognize.
You should omit the "data =" in the call, i.e.
krige(glmpred~1,data.new_alb[gd.glm,],newd=data.grd)
will work. This is a change in interface, which I recently
posted to R-pkgs:
https://stat.ethz.ch/pipermail/r-packages/2006/000154.html
Yes.
Should work.
--
Edzer