Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have managed to import a CSV file into a points vector file using GRASS v.in.ascii

v.in.ascii --o input=test1.csv output=test2 format=point fs=, skip=1 x=2 y=3 z=0 cat=0

This is test1.csv ...

p,east,north,band
TD11 3TX,375749,662231,1
AB54 7TH,362375,852448,1
....

However the column names in the .DBF are not the names in my CSV (they become: str_1, int_1 etc). I though maybe the 'columns' option of the command might help. The manual isn't very clear. It says..

For example: 'x double precision, y double precision, cat int, name varchar(10)'

1)What is 'x'. 'y', 'name' etc? Is this a) the column names in the CSV file or b) new column names that will be matched from left to right with the columns in the CSV?

2) If (b) does it include the new 'cat' column (if you use the 'cat=0'option).

I tried this....

v.in.ascii --o input=test1.csv output=test2 format=point fs=, skip=1 x=2 y=3 z=0 cat=0 columns='cat int, p varchar(8), east int, north int, band int'

But I get this error...

Sorry <int,> is not a valid option
Sorry <p> is not a valid option
Sorry <varchar(8),> is not a valid option

I thought maybe it didnt like the apostrophe so I changed to dbl quote marks - but then got other errors so I gave up experimenting until I understand the format of the command.

I'm on Windows7 64 bit, 4GB RAM, GRASS 6.4.250870M (2012)

Thanks

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Your v.in.ascii command looks fine, except for the single quotes. And I would leave out the cat parameter, let GRASS give cat values automatically. The column names in the column parameter need not match what's in the CSV files, but they must be in the same order. So you could try:

v.in.ascii in=test1.csv out=test fs=, skip=1 x=2 y=3 col="label varchar(16),x_coord double, y_coord double, band integer" 

You mentioned that you tried with double quotes but still got errors. What errors? Cheers, Micha

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.