I've just added to the geoR tutorial page an script with examples
on converting geoR's krige.conv() outputs to
SpatialGridDataFrame and SpatialPixelDataFrame formats defined by the sp
package

The relevant link is:
http://leg.ufpr.br/geoR/tutorials/kc2sp.R

These should be encapsulated on function in a (hopefully) near future
to facilitate conversion of outputs from both, krige.conv() and
krige.bayes()


As usual, comments/suggestions/improvements etc are very welcome!

Best
P.J.


Paulo Justiniano Ribeiro Jr
LEG (Laboratorio de Estatistica e Geoinformacao)
Universidade Federal do Parana
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 3361 3573
Fax: (+55) 41 3361 3141
e-mail: paulojus AT  ufpr  br
http://www.leg.ufpr.br/~paulojus



On Sun, 14 Dec 2008, Roger Bivand wrote:

> On Sun, 14 Dec 2008, Nicolas Meurisse wrote:
>
> > Hello,
> >
> > After kriging with the use of the  krige.conv function, I would like to
> > export my result under the grid format. In order to view it into a GIS.
> >
> > It was suggested to me to use the writeGDAL function into the rgdal package.
> > However It looks like I have a problem of supported formats
> > (dataset object of SpatialGridDataFrame-class or 
> > SpatialPixelsDataFrame-class
> > ) that is not the same as the one resulting from my krige.conv function
> > (kriging -class apparently)
> >
> > I tried several function to achieve this conversion (getRasterData,
> > SpatialGridDataFrame, SpatialPixelsDataFrame, create2GDAL, points2grid...).
> > But without any success.
> >
> > #my actual kriging script:
> > pred.grid = expand.grid(seq(170000, 130000, l = 50), seq(190000, 160000, l =
> > 50))
>
> library(sp)
> pred.grid$var3 <- 1
> coordinates(pred.grid) <- c("Var1", "Var2")
> gridded(pred.grid) <- TRUE
>
> # Create a SpatialPixelsDataFrame or SpatialGridDataFrame object first
> # - forced here by including a non-coordnate column to the data frame
>
> > myPred = krige.conv(myGData, loc = pred.grid, krige = krige.control(obj.m =
> > myOLSMod))
>
> myPred = krige.conv(myGData, loc = coordinates(pred.grid),
>   krige = krige.control(obj.m = myOLSMod))
>
> # Krige with the coordinates of the object
>
> pred.grid$predict <- myPred$predict
>
> # add the predictions (and standard errors if you like) to the
> # object, they are in the correct order;
> # then write out, choosing the output column as desired
>
> tf <- tempfile()
> writeGDAL(pred.grid["predict"], tf, drivername="GTiff") # not type="Byte"!
> GDALinfo(tf)
>
> # I suppose you are using the temporary file here to test your approach
> # as you ought to put the output file in a permanent place if you will
> # need it later
>
> Hope this helps,
>
> Roger
>
> > image(myPred, loc = pred.grid, col = gray(seq(1, 0.1, l = 30)))
> >
> > #my conversion attempts
> > tf <- tempfile()
> > writeGDAL(myPred, tf, drivername="GTiff", type="Byte", options=NULL)
> > [Erreur dans function (classes, fdef, mtable) : unable to find an inherited
> > method for function "gridded", for signature "kriging"]
> >
> > Thanks a lot,
> >
> > Nicolas
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [email protected]
> > 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: [email protected]
>
> _______________________________________________
> R-sig-Geo mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to