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 map
  • output=name β€” name for output ASCII grid map (use out=- for stdout), iykyk
  • precision=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.ascii
  • r.in.gdal
  • r.out.bin
  • r.out.gdal
  • r.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