[GRASS-user] r.out.gdal to AAIGrid

Markus Neteler neteler at osgeo.org
Fri Aug 4 01:52:47 PDT 2017


Hi Pedro,

I created a test case with the North Carolina sample dataset (by
zooming in the GUI to the elevation map border and setting that as
computational region):

# GRASS 7.2.2svn (nc_spm_08_grass7):~ >

# set computational region around east elevation map border
g.region n=216820 s=216770 w=644960 e=645040 res=10 -p

# be sure that no data pixels are involved.
r.out.ascii input=elevation output=-
north: 216820
south: 216770
east: 645040
west: 644960
rows: 5
cols: 8
101.913734 102.054886 102.395638 102.597229 * * * *
101.821335 102.044083 102.331108 102.58638 * * * *
101.703033 101.955849 102.195648 102.54126 * * * *
101.56945 101.840988 102.152328 102.529175 * * * *
101.530174 101.792572 102.097748 102.477859 * * * *

# export to AAIGrid format:
r.out.gdal input=elevation output=elev.grd format=AAIGrid
Driver <AAIGrid> does not support direct writing. Using MEM driver for
intermediate dataset.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <Float32>
Input raster map contains cells with NULL-value (no-data). The value -nan
will be used to represent no-data values in the input map. You can specify
a nodata value with the nodata option.
Exporting raster data to AAIGrid format...
 100%
r.out.gdal complete. File <elev.grd> created.


# verification:
cat elev.grd
ncols        8
nrows        5
xllcorner    644960.000000000000
yllcorner    216770.000000000000
cellsize     10.000000000000
NODATA_value  -nan
 101.91373443603515625 102.0548858642578125 102.39563751220703125
102.59722900390625 -nan -nan -nan -nan
 101.8213348388671875 102.0440826416015625 102.33110809326171875
102.5863800048828125 -nan -nan -nan -nan
 101.703033447265625 101.95584869384765625 102.195648193359375
102.541259765625 -nan -nan -nan -nan
 101.56945037841796875 101.8409881591796875 102.1523284912109375
102.5291748046875 -nan -nan -nan -nan
 101.53017425537109375 101.792572021484375 102.097747802734375
102.4778594970703125 -nan -nan -nan -nan

... all fine and it works out of the box!
Are you sure that you had any NULL cells at all? Note that the current
computational region is respected for export.

Markus


More information about the grass-user mailing list