## NAME

v.out.ascii - Converts a GRASS binary vector map to a GRASS ASCII vector map.

## KEYWORDS

vector, export

## SYNOPSIS

v.out.ascii
v.out.ascii help
v.out.ascii [-or] input=name [output=name] [format=string] [fs=character] [dp=integer] [layer=integer] [columns=name[,name,...]] [where=sql_query] [--verbose] [--quiet]

### Flags:

-o
  Create old (version 4) ASCII file
-r
  Only export points falling within current 3D region (points mode)
--verbose
  Verbose module output
--quiet
  Quiet module output

### Parameters:

input=name
  Name of input vector map
output=name
  Path to resulting ASCII file or ASCII vector name if '-o' is defined
format=string
  Output format
  Options: point,standard
  Default: point
fs=character
  Field separator
  Field separator (points mode)
  Default: |
dp=integer
  Number of significant digits (floating point only)
  Options: 0-32
  Default: 8
layer=integer
  Layer number
  A single vector map can be connected to multiple database tables. This number determines which table to use.
  Default: 1
columns=name[,name,...]
  Name of attribute column(s) to be exported (point mode)
where=sql_query
  WHERE conditions of SQL statement without 'where' keyword
  Example: income < 1000 and inhab >= 10000

## DESCRIPTION

v.out.ascii converts a GRASS vector map in binary format to a GRASS vector map in ASCII format. Using flag -o v.out.ascii output will be in old (version 4) ASCII format.

If the output parameter is not given then the coordinates of any point data within the vector map is sent to stdout.

## NOTES

The v.in.ascii module performs the function of v.out.ascii in reverse; i.e. it converts vector maps in ASCII format to their binary format. These two companion module are useful both for importing and exporting vector maps between GRASS and other software, and for transferring data between machines.

If the format parameter is set to standard, a GRASS ASCII vector map will be exported, which may contain a mix of primitives including points, lines, boundaries, centroids, areas, faces, and kernels. The beginning of the output ascii file will contain a header listing any metadata for the input vector map, if such metadata exists. An example of the standard format is given below.

The header is similar as the head file of vector binary format but contains bounding box also. Key words are:

    ORGANIZATION
    DIGIT DATE
    DIGIT NAME
    MAP NAME
    MAP DATE
    MAP SCALE
    OTHER INFO
    ZONE
    WEST EDGE
    EAST EDGE
    SOUTH EDGE
    NORTH EDGE
    MAP THRESH

The body begins with the row:

    VERTI:

followed by records of primitives:

    TYPE NUMBER_OF_COORDINATES [NUMBER_OF_CATEGORIES]
     X Y [Z]
    ....
     X Y [Z]
    [ LAYER CATEGORY]
    ....
    [ LAYER CATEGORY]

Everything above in `[ ]` is optional.

The primitive codes are as follows:

- 'P': point
- 'L': line
- 'B': boundary
- 'C': centroid
- 'F': face (3D boundary)
- 'K': kernel (3D centroid)
- 'A': area (boundary) - better use 'B'; kept only for backward compatibility

The coordinates are listed following the initial line containing the primitive code, the total number of vectors in the series, and (optionally) the number of categories (1 for a single layer, higher for multiple layers). Below that 1 or several lines follow to indicate the layer number and the category number (ID).
The order of coordinates is

      X Y [Z]

In pre-GRASS 6 versions of the ASCII file, the order of coordinates is:

    Y X

If old version is requested, the output files from v.out.ascii is placed in the `$LOCATION/$MAPSET/dig_ascii/` and `$LOCATION/$MAPSET/dig_att` directory.

Only features with a category number will be exported. Use v.category to add them if needed.

v.out.ascii does not copy the dig_cats file associated with the binary vector input map to the new output file name. The user must copy the dig_cats file to the new output name if this is desired (e.g. using the UNIX cp command).

It is possible to output the coordinates of vertices in a non-points vector feature by first converting the vector feature to a points map with v.to.points and then exporting with v.out.ascii in points mode.

## EXAMPLES

### Standard mode

    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

    v.out.ascii input=archsites format=point where="cat > 5 and cat <= 8" columns=str1

    600375|4925235|6|Prairie Site
    606635|4920773|7|Jensen Pass
    595755|4925300|8|No Name

## SEE ALSO

v.category, v.in.ascii, v.to.points
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, CTU in Prague, Czech Republic (2008/12)

Last changed: $Date: 2011-11-08 10:42:51 +0100 (út, 08 XI 2011) $

Main index - vector index - Full index

© 2003-2014 GRASS Development Team