r3.out.ascii(1grass)
π r3.out.ascii β the GRASS manual (1grass) but make it cute β¨
okay bestie, listen. you got a 3D raster map and you want it as text? say less. r3.out.ascii is literally the girl for the job. this is her whole manual page, and yes, we're reading the whole thing, no skimming, that's the rule. π
KEYWORDS: raster3d, export, output, voxel, conversion, ASCII
β¨ SYNOPSIS β¨
like, the whole vibe in five lines:
r3.out.ascii
r3.out.ascii --help
r3.out.ascii [-hrdcm] input=string [output=name] [precision=integer]
[null_value=string] [--overwrite] [--help] [--verbose] [--quiet]
[--ui]
π© Flags
-hβ shhh π€« no header info gets printed, we're keeping it lowkey-rβ flips the row order in the output, north->south becomes south->north-dβ flips the depth order, bottom->top becomes top->bottom-cβ prints the grass6 compatible format. heads up: flags-dand-rget ignored when you use this one π-mβ use the 3D raster mask with the input map (if one exists)--overwriteβ let output files overwrite files that already exist, no questions asked--helpβ print the usage summary--verboseβ verbose module output (she's chatty)--quietβ quiet module output (she's in her silent era)--uiβ force launching the GUI dialog π₯οΈ
π Parameters
input=stringβ [required] the 3D raster map that's getting converted to ASCIIoutput=nameβ the name for the ASCII output fileprecision=integerβ how many decimal places for the floats. Options:0-20, Default:8null_value=stringβ the string that represents a NULL value. Default:*
π DESCRIPTION π
So r3.out.ascii exports a 3D raster map in ASCII format. the input parameter is a valid 3D raster map living somewhere in your current mapset search path. the output parameter is the name of an ASCII file, and it gets written right into the current working directory. periodt. π
If you don't specify output, then standard output (that's stdout, bestie) gets used instead. and the -h flag? that's your girl for suppressing header information. also be aware this module is sensitive to region settings β the ones you set with g.region. so set them first, okay?? π
The -c flag will create GRASS 6 r3.in.ascii compatible output. iconic, but make sure that's actually what you want.
π NOTES π
The default format of the exported ASCII file is equivalent to the one that r3.in.ascii requires. so specifically: files output by r3.out.ascii with header information can be converted back into 3D raster maps using r3.in.ascii. it's giving reversible. π
And here's the format of the ASCII file, character for character:
version: "grass7"
order: "nsbt" or "nstb" or "snbt" or "sntb"
north: floating point
south: floating point
east: floating point
west: floating point
top: floating point
bottom: floating point
rows: integer
cols: integer
levels: integer
The version and order options got introduced in GRASS 7, in June 2011. the order option describes the order of rows and depths in the output. you can create output with a different row order using the -r flag, and output with a different depth order using the -d flag. the default order is:
- west -> east for columns
- north -> south for rows
- bottom -> top for depths
This header is followed by the cell values in floating point format, organized in rows with constant col and level coordinate. the rows are organized by constant level coordinate. individual cell values are separated by space or CR. cell values are exported as a series of horizontal slices in row-major order. the data starts with the upper left corner (NW) at the bottom of the data set. the values at the following coordinates are exported:
(x, y + rows, z) (x + 1, y + rows, z) ... (x + cols, y + rows, z)
(x, y + rows, z) (x + 1, y + rows - 1, z) ... (x + cols, y + rows - 1, z)
. . .
. . .
. . .
(x, y, z + depths) (x + 1, y, z + depths) ... (x + cols, y, z + depths)
This order is compatible with the r.in.ascii row -> column ordering. mutual besties fr fr π«Ά
The supported orders, bestie π
nsbt: north -> south and bottom -> top ordering β this is the default, no flags neededsnbt: south -> north and bottom -> top ordering, using the-rflagnstb: north -> south and top -> bottom ordering, using the-dflagsntb: south -> north and top -> bottom ordering, using the-rdflag
The internal storage scheme of 3D raster maps is visualized in the following picture:
πΌοΈ The coordinate system and tile layout of a voxel map in GRASS
One level maps can be imported with r.in.ascii (that's 2D raster) using the default nsbt order and removing the header lines "version", "order", "top", "bottom" and "levels". just pluck them out, slay π
π EXAMPLES π
okay let's get hands-on. we define a small region with 4 columns, 3 rows and 2 depths (4x3x2) and export it using different ordering definitions:
g.region res3=1 t=2 b=0 w=0 e=4 s=0 n=3
r3.mapcalc "simple_example = row() + col() + depth()"
Default order:
r3.out.ascii input=simple_example dp=0
version: grass7
order: nsbt
north: 3.000000
south: 0.000000
east: 4.000000
west: 0.000000
top: 2.000000
bottom: 0.000000
rows: 3
cols: 4
levels: 2
3 4 5 6
4 5 6 7
5 6 7 8
4 5 6 7
5 6 7 8
6 7 8 9
Inverse row order (-r)
r3.out.ascii input=simple_example dp=0 -r
version: grass7
order: snbt
north: 3.000000
south: 0.000000
east: 4.000000
west: 0.000000
top: 2.000000
bottom: 0.000000
rows: 3
cols: 4
levels: 2
5 6 7 8
4 5 6 7
3 4 5 6
6 7 8 9
5 6 7 8
4 5 6 7
Inverse depth order (-d)
r3.out.ascii input=simple_example dp=0 -d
version: grass7
order: nstb
north: 3.000000
south: 0.000000
east: 4.000000
west: 0.000000
top: 2.000000
bottom: 0.000000
rows: 3
cols: 4
levels: 2
4 5 6 7
5 6 7 8
6 7 8 9
3 4 5 6
4 5 6 7
5 6 7 8
Inverse row and depth order (-rd)
r3.out.ascii input=simple_example dp=0 -rd
version: grass7
order: sntb
north: 3.000000
south: 0.000000
east: 4.000000
west: 0.000000
top: 2.000000
bottom: 0.000000
rows: 3
cols: 4
levels: 2
6 7 8 9
5 6 7 8
4 5 6 7
5 6 7 8
4 5 6 7
3 4 5 6
π SEE ALSO π
your other favs, go say hi:
r3.in.asciir.out.asciig.region
π AUTHORS π
Roman Waupotitsch, Michael Shapiro, Helena Mitasova, Bill Brown, Lubos Mitas, Jaro Hofierka, SΓΆren Gebbert. absolute legends, all of them. π
π¦ SOURCE CODE π¦
Available at: r3.out.ascii source code (history)
Latest change: Wednesday Oct 01 19:33:56 2025 in commit: 2bff9b53785aeeed0248becad0089c3a0ec05479
Main index | 3D raster index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page, bestie!! πΈ Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual π go export some voxels, you're gonna ate π β¨π¦
π¦ 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