[GRASS-user] Sites/Points File Input

Markus Neteler neteler at osgeo.org
Fri Nov 20 17:18:07 EST 2009


On Fri, Nov 20, 2009 at 11:06 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>  There have apparently been changes from version 5.x to 6.4 in how point
> data are entered. No longer are there the 's.' functions (e.g., s.in.ascii),
> so we use the v.in.ascii function now. The man page lays out the options,
> but I would like a reality check on the input data format I created using
> the book (2nd ed) as a guide (pages 80-81):
>
> cat|longitude|latitude|name
> 1|122:30:32.43W|45:19:19.49N|@"Lockie property"
> 2|122:30:17.92W|45:18:52.45N|@"Mompano Dam spillway"
> 3|122:29:34.08W|45:18:47.16N|@"OR-CC-8"
>
>  If this format is still valid,

almost.
- take out  @
- take out "" (if you want)
- call the first column "id" rather than "cat" which is internal
   (indeed, you don't need that column)

> I propose the following command:
>
> v.in.ascii -b input="sites.txt" output="keyPts" format="point" skip=1 \
> columns='cat int, x double, y double, name varchar(20)' x=1 y=2 cat=0

notes:
- x is 2nd column etc.
- -b is no good. It is only for GB of Lidar data since most GRAS modules
   want topology to be present
- cat=0: don't use it since we let v.in.ascii generate the cat column
- use "..." for columns=

So it would be:

id|longitude|latitude|name
1|122:30:32.43W|45:19:19.49N|Lockie property
2|122:30:17.92W|45:18:52.45N|Mompano Dam spillway
3|122:29:34.08W|45:18:47.16N|OR-CC-8

v.in.ascii input="sites.txt" output="keyPts" format="point" skip=1 \
              columns="id integer, x double precision, y double precision, \
              name varchar(20)" x=2 y=3

v.db.select keyPts
cat|id|x|y|name
1|1|-122.509008|45.322081|Lockie property
2|2|-122.504978|45.314569|Mompano Dam spillway
3|3|-122.4928|45.3131|OR-CC-8

Hope that helps,
Markus


More information about the grass-user mailing list