[GRASS-user] v.in.ascii - put1 of 4 columns to 3D point file attribute

Hamish hamish_b at yahoo.com
Thu Apr 10 02:39:11 EDT 2008

Mark wrote:
> I have an ascii table of lidar data.  The columns are x,y,z, and a
> fourth column containing an integer code of some sort.

how many points are we talking about? millions? it the table becoming too

wc -l inputfile.txt

> I have looked at the example in the man page about how to select
> columns for importing via some shell manipulation of the input ascii
> file, but I do not think it is applicable to what I'm doing (or perhaps
> the caffeine boost is not in effect yet).  I have also tried various
> combinations of parameters in v.in.ascii.
> I would like to import the XYZ to build the geometry for 3D points, and
> have only "Cat" and "Code" in the attribute table.  ("Code" being a
> column name for the 4th column in the input ASCII).  I cant seem to
> find the combination of column definitions and other parameters to
> achieve this.  One option seems to import them all as "x double, y
> double, z double, code int", and then after the import, drop the x,y,z
> columns.

In GRASS 6.3:  v.db.dropcol

For GRASS 6.2.3 you can examine that script and do the SQLite trick by

> Is it possible to put the first 3 ASCII column values to the geometry,
> and use only the last column as an attribute?

another idea is to crop the file to only include the cat and code
  cut -f1,4 -d',' inputfile.txt > outputfile.txt
then use db.in.ogr (GRASS 6.3 only) to import the .csv file into SQLite,
and then use v.db.connect to connect that database to your vector.
(triple-check the cat+codes line up; is there a cat column or is that
just sequential order? if so, use "seq" + "paste" to add that to the
cut'ed code-only file)

yet another idea is to do it like v.in.garmin/v.in.gpsbabel scripts, but
that may be slow for many many points.

> I'm using GRASS 6.2.3 and sqlite database.


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the grass-user mailing list