[GRASS-user] importing a vector, problem with duplicate column name: cat_

Markus Metz markus.metz.giswork at gmail.com
Thu Aug 4 01:29:26 PDT 2016

On Thu, Aug 4, 2016 at 10:06 AM, Margherita Di Leo <diregola at gmail.com> wrote:
> Markus,
> On Thu, Aug 4, 2016 at 9:48 AM, Markus Metz <markus.metz.giswork at gmail.com>
> wrote:
>> On Thu, Aug 4, 2016 at 9:24 AM, Margherita Di Leo <diregola at gmail.com>
>> wrote:
>> > Hi,
>> >
>> > importing a vector either using v.import GUI or v.in.ogr, it tries to
>> > rename
>> > the column <cat> into <cat_>, but both already exist and it throws out
>> > an
>> > error.
>> >
> [...]
>> >
>> > Is there a way to overcome this?
>> you can overcome this with the columns option of v.in.ogr.
> Thank you for your suggestion. Do I understand correctly that this will add
> a third column?

The columns option does not add another column, it provides column
names: "List of column names to be used instead of original names,
first is used for category column"

> If in my work flow I have to import-process-export multiple
> times, this will add a column every time unless I explicitly drop a column?

Yes, or use the key option of v.in.ogr. With your vector you could use
v.in.ogr key=cat, then drop the cat_ column. The next time you
re-import the vector, use again the key option, this should avoid that
"categories are generated as unique values and stored in [in a newly
created] 'cat' column"

Markus M
> --
> Margherita Di Leo

More information about the grass-user mailing list