v.out.ascii(1grass)
π v.out.ascii β the GRASS manual, but make it bestie-core π
okay so. You know how you've got a vector map sitting in GRASS in binary format and you're like "bestie I need this as text"? Yeah. That's literally what v.out.ascii is for β it's the v.out.ascii module from the GRASS User's Manual, and it converts your vector map into a GRASS ASCII vector representation. β¨
Also important: by default it only exports features that have a category. If you want everything β every last feature, category or not β you use 'layer=-1'. Don't forget that, it's giving sneaky. π«Ά
π·οΈ KEYWORDS
vector, export, output, ASCII
β¨ SYNOPSIS β¨
v.out.ascii
v.out.ascii --help
v.out.ascii [-ocr] input=name [layer=string]
[type=string[,string,...]] [output=name] [columns=name[,name,...]]
[cats=range] [where=sql_query] format=string [separator=character]
[precision=integer] [--overwrite] [--help] [--verbose] [--quiet]
[--ui]
π Flags
-oβ Create old (version 4) ASCII file-cβ Include column names in output (points mode)-rβ Only export points falling within current 3D region (points mode)--overwriteβ Allow output files to overwrite existing files--helpβ Print usage summary--verboseβ Verbose module output--quietβ Quiet module output--uiβ Force launching GUI dialog
πΈ Parameters
input=name[required] β Name of input vector map. Or data source for direct OGR access.layer=stringβ Layer number or name ('-1' for all layers). A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name. Default:1type=string[,string,...]β Input feature type. Options:point,line,boundary,centroid,area,face,kernel. Default:point,line,boundary,centroid,area,face,kerneloutput=nameβ Name for output ASCII file or ASCII vector name if '-o' is defined. If not given or '-' then standard output.columns=name[,name,...]β Name of attribute column(s) to be exported (point mode). '*' for all columns.cats=rangeβ Category values. Example:1,3,7-9,13where=sql_queryβ WHERE conditions of SQL statement without 'where' keyword. Example:income < 1000 and population >= 10000format=string[required] β Output format. Options:point,standard,wkt. Default:pointpoint: Simple point format (point per row)standard: GRASS ASCII vector formatwkt: OGC well-known text
separator=characterβ Field separator. Field separator (points mode). Default:pipeprecision=integerβ Number of significant digits (floating point only). Options:0-32. Default:8
π DESCRIPTION π
v.out.ascii converts a GRASS vector map in binary format to a GRASS vector map in ASCII format. And if you hit the -o flag, the output from v.out.ascii will be in old (version 4) ASCII format. Retro. Vintage. Iconic, honestly. π¦
And if you don't give it an output parameter? It just sends the data straight to standard output. No notes, she's low maintenance. π
π§ NOTES π§
The v.in.ascii module does the exact reverse of v.out.ascii β it converts vector maps in ASCII format to binary format. These two companion modules are so useful for importing and exporting vector maps between GRASS and other software, and also for transferring data between machines. Dynamic duo behavior, no cap. π
If an old version is requested, the output files from v.out.ascii get placed in the $LOCATION/$MAPSET/dig_ascii/ and $LOCATION/$MAPSET/dig_att directory. π
If layer > 0 then only features with a category number will be exported. Use v.category to add them if you need to, or define layer=-1 to export features without category too.
β οΈ Heads up bestie:v.out.asciiin the old version mode (-o) does not copy thedig_catsfile associated with the binary vector input map to the new output file name. You have to copy thedig_catsfile to the new output name yourself if that's what you want (e.g. using the UNIXcpcommand). She will not do it for you. Sorry. π
And here's a little trick: you can output the coordinates of vertices in a non-points vector feature β first convert the vector feature to a points map with v.to.points, and then export with v.out.ascii in points mode. Gateway feature, honestly. β¨
π EXAMPLES π
Standard mode
See ASCII format specification.
v.out.ascii input=quads format=standard
ORGANIZATION: US Army Const. Eng. Rsch. Lab
DIGIT DATE: May 1987
DIGIT NAME: grass
MAP NAME: Quads
MAP DATE: May 1987
MAP SCALE: 24000
OTHER INFO:
ZONE: 13
MAP THRESH: 18.288000
VERTI:
B 4
599587.1820962 4914067.53414294
589639.15126831 4913922.5687301
589440.96838162 4927803.62500018
599375.87959179 4927959.83330436
B 2
599375.87959179 4927959.83330436
599587.1820962 4914067.53414294
B 4
599587.1820962 4914067.53414294
609541.5508239 4914236.0597482
609316.10665227 4928116.8490555
599375.87959179 4927959.83330436
C 1 1
594125.63 4921115.58
1 1
C 1 1
604433.84 4921087.1
1 2
Point mode
v.out.ascii input=quads format=point
594125.63|4921115.58|1
604433.84|4921087.1|2
Print also selected attributes:
v.out.ascii input=geodetic_pts format=point where="cat > 5 and cat <= 8" columns=GEOD_NAME
573638.06289275|271623.25042595|6|27 WC 6
574416.81289275|274116.65542595|7|27 WC 7
575301.31189275|275303.81342595|8|27 WC 8
To print all attributes type columns=*:
v.out.ascii input=geodetic_pts format=point where="cat > 5 and cat <= 8" columns=*
573638.06289275|271623.25042595|6|6|0.00000000|0.00000000|6|6|27 WC 6|573638.09200000|271623.24100000|0.00|0|1.00000000|1.00000000
574416.81289275|274116.65542595|7|7|0.00000000|0.00000000|7|7|27 WC 7|574416.84100000|274116.64900000|0.00|0|1.00000000|1.00000000
575301.31189275|275303.81342595|8|8|0.00000000|0.00000000|8|8|27 WC 8|575301.30600000|275303.82600000|0.00|0|1.00000000|1.00000000
WKT mode
WKT is abbreviation for Well-known text.
v.out.ascii input=quads format=wkt
POLYGON((599587.18209620 4914067.53414294, 589639.15126831 4913922.56873010,
589440.96838162 4927803.62500018, 599375.87959179 4927959.83330436,
599587.18209620 4914067.53414294))
POLYGON((599587.18209620 4914067.53414294, 599375.87959179 4927959.83330436,
609316.10665227 4928116.84905550, 609541.55082390 4914236.05974820,
599587.18209620 4914067.53414294))
π SEE ALSO π
v.category, v.in.ascii, v.to.points
GRASS ASCII vector format specification
GRASS SQL interface
π AUTHORS π
- Michael Higgins, U.S. Army Construction Engineering Research Laboratory
- James Westervelt, U.S. Army Construction Engineering Research Laboratory
- Radim Blazek, ITC-Irst, Trento, Italy
- Attribute selection added by Martin Landa, Czech Technical University in Prague, Czech Republic (2008/12)
π SOURCE CODE π
Available at: v.out.ascii source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit: a82a39f673b97fafcfce1604dc3e6015cb96487a
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
and that's the whole thing, bestie β you made it to the end, slay π
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β this manual page is for GRASS 8.5.0, the manual name is v.out.ascii(1grass), and she was served to you fresh. Periodt. πβ¨π¦
π¦ 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