[R-sig-Geo] INTAMAP--->GeoTIFF
Alexandre Villers
villers.alexandre at gmail.com
Fri Dec 17 10:54:40 CET 2010
Hey,
After checking the vignette of Intamap, you can find out from this
example that
data(meuse)
coordinates(meuse) = ~x+y
meuse$value = meuse$zinc
data(meuse.grid)
gridded(meuse.grid) = ~x+y
x = interpolate(meuse, meuse.grid, list(mean=TRUE, variance=TRUE))
x$predictions is a SpatialPixelsDataFrame which can easily be writen
into a Geotiff with writeGDAL
str(x$predictions)
Formal class 'SpatialPixelsDataFrame' [package "sp"] with 7 slots
..@ data :'data.frame': 3103 obs. of 2 variables:
.. ..$ var1.pred: num [1:3103] 855 918 831 745 988 ...
.. ..$ var1.var : num [1:3103] 42417 32710 35528 38716 22472 ...
..@ coords.nrs : num(0)
..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots
.. .. ..@ cellcentre.offset: Named num [1:2] 178460 329620
.. .. .. ..- attr(*, "names")= chr [1:2] "x" "y"
.. .. ..@ cellsize : Named num [1:2] 40 40
.. .. .. ..- attr(*, "names")= chr [1:2] "x" "y"
.. .. ..@ cells.dim : Named int [1:2] 78 104
.. .. .. ..- attr(*, "names")= chr [1:2] "x" "y"
..@ grid.index : int [1:3103] 69 146 147 148 223 224 225 226 300 301 ...
..@ coords : num [1:3103, 1:2] 181180 181140 181180 181220 181100 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "x" "y"
..@ bbox : num [1:2, 1:2] 178440 329600 181560 333760
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "x" "y"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. ..@ projargs: chr NA
Watch out that the projection is not defined.
I guess that writeGDAL(x$predictions, ....) with appropriate file name
and driver should do the trick
HTH
Alex
More information about the R-sig-Geo
mailing list