r.out.ascii(1grass)
β¨ r.out.ascii β¨
okay bestie, gather round, because this is the GRASS User's Manual page for r.out.ascii, and it is literally the glow-up your raster map needs before it goes out into the world π
π KEYWORDS
raster, export, output, ASCII, Surfer, Modflow, Lisflood
π SYNOPSIS
r.out.ascii
r.out.ascii --help
r.out.ascii [-hsmli] input=name [output=name] [precision=integer]
[width=integer] [null_value=string] [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
π¦ Flags:
-hβ please, no header info, keep it quiet-sβ write it as a SURFER (Golden Software) ASCII grid, iconic-mβ write it as a MODFLOW (USGS) ASCII array, slay-lβ write it as a LISFLOOD (EU) ASCII array, periodt-iβ force the output to be integer values only, no decimals allowed--overwriteβ let output files overwrite files that already exist--helpβ print the usage summary--verboseβ verbose module output, she's chatty--quietβ quiet module output, she's giving silence--uiβ force launching GUI dialog
πΈ Parameters:
input=name[required] β name of input raster mapoutput=nameβ name for output ASCII grid map (useout=-for stdout), iykykprecision=integerβ number of significant digits (floating point only)width=integerβ number of values printed before wrapping a line (only SURFER or MODFLOW format)null_value=stringβ string to represent null cell (GRASS grid only). Default:*
π DESCRIPTION
So basically r.out.ascii takes a raster map layer you picked (input=name) and converts it into an ASCII grid inside a text file (output=name), all ready to be exported to other computer systems. Chef's kiss.
And if you ever want to reverse the whole thing? The GRASS program r.in.ascii does exactly that β it takes an ASCII file in a suitable format and turns it into a GRASS raster map format. We love a two-way street π«Ά
Wanna write a SURFER .grd ASCII GRID file (yes, it comes with reverted row order and a different header)? Use the -s flag:
r.out.ascii -s input=inname output=outname.grd [dp=value]
NULL data get coded to "1.70141e+038" for SURFER ASCII GRID files β and yes, that means the null= parameter gets ignored. Not a vibe, but it's the rules.
Wanna write a LISFLOOD .dem ASCII GRID file (different header again)? Use the -l flag:
r.out.ascii -l input=inname output=outname.dem
NULL data output in this case gets set by the user at "-9999", see below:
ncols 1514
nrows 2747
xllcorner 212236
yllcorner 2910116
cellsize 120
NODATA_value -9999
π NOTES
You can yeet the output from r.out.ascii straight into a file using the UNIX redirection mechanism, like this:
r.out.ascii input=soils output=- > out.file
Then that out.file can be printed, or copied onto a CDROM or floppy disk for export purposes. (floppy disk. yes. iconic retro behavior πΎβ¨)
oh also β if you wanna export the raster values as x,y,z values of cell centers (one per line), you want the r.out.xyz module instead, bestie. different girl, different job.
π SEE ALSO
r.in.asciir.in.gdalr.out.binr.out.gdalr.out.xyz
π AUTHORS
- Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
- Surfer support by Markus Neteler
πΎ SOURCE CODE
Available at: r.out.ascii source code (history)
Latest change: Sunday Oct 05 01:26:10 2025 in commit: 14fd3ee61b78346fc901c0aa1d874c83c16cc51a
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page, bestie π this was GRASS 8.5.0 you've been reading, from the Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β go export something gorgeous π¦β¨π
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms