Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have managed to import a CSV file into a points vector file using GRASS --o input=test1.csv output=test2 format=point fs=, skip=1 x=2 y=3 z=0 cat=0

This is test1.csv ...

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.... --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)


share|improve this question
up vote 3 down vote accepted

Your 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: 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

The columns parameter should have the resulting column names and types in the same order as they are on the input file.

So for your file it should be something like:

col='p varchar(8), x int, y int, band int'

The single or double quotes should not be an issue

Please note that you don't have to specify the cat parameter if the input file itself doesn't have it, it defaults to 0.

share|improve this answer

Your Answer


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.