42
Example
r.writedatatoeld(ruid="PntID", rvector="weight", out="C:ndatansamples.shp",
uideld="PntID", dataeld="WEIGHT", eldtype="DOUBLE");
r.writedatatoeld(ruid="FID", rvector="label", out="C:ndatanlakes.shp", uideld="FID",
dataeld="MAPLABEL", eldtype="STRING");
3.94 r.writedatatoraster
Write R Matrix To Raster: Writes data in an R matrix to a raster format.
Description
This command will write values from a 2 dimensional R matrix to a raster format. The
spatial positioning of the matrix data can be dened in two ways. You can either specify
the positioning parameters explicitly, including the coordinates of the lower left corner of
the raster (llx, lly parameters), the cellsize, and the le containing the projection denition,
or you can reference an existing reference dataset from which these values are acquired.
Note that the dimensions of the new raster are based on the dimension of the matrix, not
the dimension of the reference raster. When specifying the matrix object in the current R
seesion note that R is case sensitive.
Syntax
r.writedatatoraster(rmatrix, out, [reference], [llx], [lly], [cellsize], [prj], [pixeltype]);
rmatrix
the R matrix containing the data values to be written
out
the output raster, including the extension in the case of an IMG or TIF
formats
[reference] a reference raster data source from which the llx, lly, cellsize and prj pa-
rameters will be acquired (do not specify the other optional parameters)
[llx]
the x coordinate of the lower left corner of the raster
[lly]
the y coordinate of the lower left corner of the raster
[cellsize]
the raster pixel cell size
[prj]
the le containing the projection data of the input raster
[pixeltype] the pixel type of the raster (if DOUBLE, must be an IMG raster) (de-
fault=DOUBLE; options: SHORT, LONG, DOUBLE, FLOAT)
Example
r.writedatatoraster(rmatrix="f", out="C:ndatanrandomlandscape.img",
reference="C:ndatanDEM", pixeltype="DOUBLE");
r.writedatatoraster(rmatrix="f", out="C:ndatanrf1", llx=520000, lly=4950000,
cellsize=100, prj="C:ndatanUTMZn17N
WGS1984.prj", pixeltype="FLOAT");
124