[R-sig-Geo] dumping interpolated results into grass6...
Roger Bivand
Roger.Bivand at nhh.no
Mon Feb 6 13:45:41 CET 2006
On Mon, 6 Feb 2006, A Horacio Samaniego wrote:
> I wonder if there are any Xtra trick to dump a SpatialPixelDataFrame into
> grass6? I get the following error. (I seem to have rgdal up and running.)
>
> > writeRast6sp(kk,"idw_hs",zcol="var1.pred",NODATA=-9999.99)
> Error in writeRast6sp(kk, "idw_hs", zcol = "var1.pred", NODATA = -9999.99)
> :
> only numeric columns may be exported
>
>
> I have read the vignettes and
> http://grass.gdf-hannover.de/twiki/bin/view/GRASS/GrassSixTutorial#Mini_How_to_interpolate_using_kr
> carefully... And I'm not sure where ( and if?) I'm doing this wrong...
>
Thanks for a full report. Could you attach (or put on a website) the file
resulting from:
save(kk, file="kk.RData", compress=TRUE)
to me *off* the list, please? str() below indicates that var1.pred is
present, so the test inside writeRast6sp() seems to be getting things
wrong.
Roger
>
> thanks!
>
> H
>
>
> Here is the full command sequence and checks:
>
>
> > library(gstat)
> Loading required package: sp
> > library(spgrass6)
> Loading required package: rgdal
> Loading required package: abind
> Loading required package: pixmap
> Geospatial Data Abstraction Library extensions to R successfully loaded
> > kk<-idw(glmpred~1,data.new_alb[gd.glm,],data.grd)
> [inverse distance weighted interpolation]
> > writeRast6sp(kk,"idw_hs",zcol="var1.pred",NODATA=-9999.99)
> Error in writeRast6sp(kk, "idw_hs", zcol = "var1.pred", NODATA = -9999.99)
> :
> only numeric columns may be exported
> > str(kk)
> Formal class 'SpatialPixelsDataFrame' [package "sp"] with 7 slots
> ..@ data :Formal class 'AttributeList' [package "sp"] with 1 slots
> .. .. ..@ att:List of 2
> .. .. .. ..$ var1.pred: num [1:208874] 0.503 0.503 0.504 0.504 0.504 ...
> .. .. .. ..$ var1.var : num [1:208874] NA NA NA NA NA NA NA NA NA NA ...
> ..@ coords.nrs : num(0)
> ..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots
> .. .. ..@ cellcentre.offset: Named num [1:2] -1333373 -2356259
> .. .. .. ..- attr(*, "names")= chr [1:2] "s1" "s2"
> .. .. ..@ cellsize : Named num [1:2] 8007 7999
> .. .. .. ..- attr(*, "names")= chr [1:2] "s1" "s2"
> .. .. ..@ cells.dim : Named int [1:2] 362 577
> .. .. .. ..- attr(*, "names")= chr [1:2] "s1" "s2"
> ..@ grid.index : int [1:208874] 1 2 3 4 5 6 7 8 9 10 ...
> ..@ coords : num [1:208874, 1:2] -1333373 -1325366 -1317359 -1309352
> -1301345 ...
> .. ..- attr(*, "dimnames")=List of 2
> .. .. ..$ : NULL
> .. .. ..$ : chr [1:2] "s1" "s2"
> ..@ bbox : num [1:2, 1:2] -1337376 -2360258 1561158 2254928
> .. ..- attr(*, "dimnames")=List of 2
> .. .. ..$ : chr [1:2] "s1" "s2"
> .. .. ..$ : chr [1:2] "min" "max"
> ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
> .. .. ..@ projargs: chr NA
> >
>
> > getGDALDriverNames()
> [1] "GRASS" "VRT" "GTiff" "NITF" "HFA" "SAR_CEOS"
> [7] "CEOS" "ELAS" "AIG" "AAIGrid" "SDTS" "OGDI"
> [13] "DTED" "PNG" "JPEG" "MEM" "JDEM" "GIF"
> [19] "ESAT" "BSB" "XPM" "BMP" "AirSAR" "RS2"
> [25] "PCIDSK" "PCRaster" "ILWIS" "RIK" "GMT" "netCDF"
> [31] "HDF4" "HDF4Image" "PNM" "DOQ1" "DOQ2" "ENVI"
> [37] "EHdr" "PAux" "MFF" "MFF2" "FujiBAS" "GSC"
> [43] "FAST" "BT" "LAN" "CPG" "IDA" "NDF"
> [49] "JPEG2000" "L1B" "FIT" "RMF" "USGSDEM" "GXF"
>
> _______________________________________________
> 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