[R-sig-Geo] problem in krige function

Roger Bivand Roger.Bivand at nhh.no
Thu Apr 5 15:11:25 CEST 2007


On Thu, 5 Apr 2007, Edzer J. Pebesma wrote:

> temiz wrote:
> > following the topic GRASS and R kriging interpolation from grass6 tutorial
> >
> > I came here without problems
> >
> > But here:
> >
> > zz <- krige(z ~ 1, locations = el1 , newdata = mask_SG , model = efitted)
> > Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim,  :
> >         var1 : data item in gstat object and newdata have different 
> > coordinate reference systems
> >
> > how can I solve this problem ?
> >   
> 
> How about making sure they are equal? If you know they are equal, do
> 
> proj4string(el1) = CRS(proj4string(mask_SG))

or better:

proj4string(mask_SG) = CRS(proj4string(el1))

> 
> else use spTransform from rgdal to re-project.
> 
> gstat checks that the projection strings are exactly equal; this is a 
> check too strong, and should be replaced by some check that they 
> represent exactly the same projection. Does anyone know how to perform 
> this check?

No, OGR/PROJ.4 use ellipse names, GRASS tends to break them out as a=, b=, 
arguments. The solution if you know that they should be the same is as you 
give it - the problem is only with the R/GRASS interface.

Roger

> --
> Edzer
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list