NAME

v.in.ascii - Convert GRASS ascii file or points file to binary vector. If option 'input' is not used, the module read points from standard input ('points mode').

SYNOPSIS

v.in.ascii
v.in.ascii help
v.in.ascii [-zte] [input=string] output=string [columns=string] [xcol=integer] [ycol=integer] [zcol=integer] [catcol=integer]

Flags:

-z
create 3D file
-t
Do not create table in points mode.
-e
Create a new empty map and exit. Nothing is read from input.

Parameters:

input=string
ascii file to be converted to binary vector file
output=string
Name of output vector
columns=string
Columns definition for points mode in SQL style, for example:
'x double precision, y double precision, cat int, name varchar(10)'
xcol=integer
Number of column used as x coordinate (first column is 1) for points mode.
Default: 1
ycol=integer
Number of column used as y coordinate (first column is 1) for points mode.
Default: 2
zcol=integer
Number of column used as z coordinate (first column is 1) for points mode. If 0, z coordinate is not used.
Default: 0
catcol=integer
Number of column used as category (first column is 1) for points mode. If 0, unique category is assigned to each row and written to new column 'cat'.
Default: 0

DESCRIPTION

v.in.ascii converts a vector map in ASCII format to a vector map in binary format. The module may be run in 2 modes:

NOTES

Using flag -z converts ascii data to 3D binary vector map

After running this program, GRASS support files must be built with v.build for the binary output file

EXAMPLES

Example 1
Direct file editing: Sample ASCII vector file (stored in dig_ascii/). Note the blank before entering vertex coordinates:

	ORGANIZATION: GRASS Development Team
	DIGIT DATE:   1/9/2002
	DIGIT NAME:   -
	MAP NAME:     test
	MAP DATE:     2002
	MAP SCALE:    10000
	OTHER INFO:   Test polygons
	ZONE:         0
	MAP THRESH:   0.500000
	VERTI:
       A  13
        5958812.48844435 3400828.84221011
        5958957.29887089 3400877.11235229
        5959021.65906046 3400930.7458436
        5959048.47580612 3400973.65263665
        5959069.92920264 3401032.64947709
        5958812.48844435 3400828.84221011
       A  8
        5959010.9323622 3401338.36037757
        5959096.7459483 3401370.54047235
        5959091.38259917 3401450.99070932
        5959010.9323622 3401338.36037757
The associated dig_att file needs following format (store in dig_att/):

       A 3401180.463379 5959003.209139          1
       A 3401516.741397 5958966.635071          2

The associated dig_cats file needs following format:

      # 2 categories
      Vector map: test
 
      0.00 0.00 0.00 0.00
      1:forest
      2:water

Example 2
Generate a points vector file 'coords.txt' as ASCII file:

  1664619|5103481
  1664473|5095782
  1664273|5101919
  1663427|5105234
  1663709|5102614

Import into GRASS:

cat coords.txt | v.in.ascii out=mymap

Example 3
Generate a points vector file 'points.dat' as ASCII file:

  1|1664619|5103481|studna
  2|1664473|5095782|kadibudka
  3|1664273|5101919|hruska
  4|1663427|5105234|mysi dira
  5|1663709|5102614|mineralni pramen

Import into GRASS:

cat points.dat | v.in.ascii out=mypoints xcol=2 ycol=3 catcol=1 columns='cat int, x double, y double, label varchar(20)'

The module is reading from standard input, delimiter is '|' (pipe).

Example 3
Generating a 3D points vector map from DBMS (idcol must be an integer column):

echo "select east,north,elev,idcol from mytable " | db.select -c | v.in.ascii -z out=mymap
The module is reading from standard input, delimiter is '|' (pipe). The import works for 2D maps as well (no elev column and no '-z' flag).

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

The input from v.in.ascii has to be placed into $LOCATION/dig_ascii (this directory must be created if not existing) or piped into the module.

SEE ALSO

v.out.ascii, v.build

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

Last changed: $Date: 2004/04/14 14:11:23 $


Help Index