How to get geotiff image

I want to have a Geotiff image in R. How can I do this? The following is a simple example. I want the created plot in Geotiff format.

require(gstat) data(meuse) coordinates(meuse) = ~x+y data(meuse.grid) gridded(meuse.grid) = ~x+y m <- vgm(.59, "Sph", 874, .04) # ordinary kriging: x <- krige(log(zinc)~1, meuse, meuse.grid, model = m) spplot(x["var1.pred"], main = "ordinary kriging predictions") 
+6
source share
2 answers

Convert your SpatialPixelsDataFrame to a raster file and write it:

 > require(raster) > r = raster(x["var1.pred"]) > plot(r) > writeRaster(r,"r.tiff","GTiff") 

plot is optional.

+7
source

Enter SpatialPixelsDataFrame directly into the raster format using rgdal , which provides bindings to GDAL . There are many things you can do with GDAL, for example, reading and / or writing a wide range of raster formats, pixel types, coordinate conversion, multi-range support, etc.

 require(rgdal) writeGDAL(x["var1.pred"], "var1_pred.tif") 
0
source

All Articles