Geospatial Modelling Environment

r.writedatatoraster (Write R Matrix To Raster)

Writes data in an R matrix to a raster format


This command will write values from a 2 dimensional R matrix to a raster format. The spatial positioning of the matrix data can be defined 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 file containing the projection definition, 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.


r.writedatatoraster(rmatrix, out, [reference], [llx], [lly], [cellsize], [prj], [pixeltype]);

rmatrixthe R matrix containing the data values to be written
outthe 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 parameters 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 file containing the projection data of the input raster
[pixeltype]the pixel type of the raster (if DOUBLE, must be an IMG raster) (default=DOUBLE; options: SHORT, LONG, DOUBLE, FLOAT)


r.writedatatoraster(rmatrix=”f”, out=”C:datarandomlandscape.img”, reference=”C:dataDEM”, pixeltype=”DOUBLE”);

r.writedatatoraster(rmatrix=”f”, out=”C:datarf1″, llx=520000, lly=4950000, cellsize=100, prj=”C:dataUTMZn17N_WGS1984.prj”, pixeltype=”FLOAT”);


Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn