[GRASS5] [bug #3623] (grass) v.in.ogr fails when input contains a
column 'CAT'
Michael Barton
michael.barton at asu.edu
Thu Sep 15 16:24:58 EDT 2005
AND if the existing table contains a column named cat_, it will OGR will
fail.
In other words, if you append 2 tables together using OGR, it will rename
the old column cat_ and provide a new column--with a single integer
series--called CAT. If you try and append THAT table to another one, it will
fail because it tries to make a duplicate cat_ column.
Ideally, it should just continue to append existing cat numbers to existing
cat_ column, and continue with the existing series in CAT.
Michael
______________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA
voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
> From: Maciek Sieczka <werchowyna at epf.pl>
> Date: Wed, 14 Sep 2005 19:37:50 +0200
> To: Hamish <hamish_nospam at yahoo.com>, Request Tracker
> <grass-bugs at intevation.de>
> Cc: grass devel <grass5 at grass.itc.it>
> Subject: Re: [GRASS5] [bug #3623] (grass) v.in.ogr fails when input contains a
> column 'CAT'
>
> From: "Hamish" <hamish_nospam at yahoo.com>
>
>> use the cnames= option to rename the column to something non-reserved,
>
> You are right in general.
>
> But there is something more to it. If my input shapefile contains 'cat'
> column (*lowercase*), it is imported without the error message as 'cat_'.
> The error pops up only when the column name is 'CAT' - uppercase.
>
> Neither behaviour is a good solution I think. Forcing 'cat_' is no good
> because it may always happen that you want to export your vector file again
> to shapefile for external processing and the import it back to Grass. Then
> you end up with a message:
>
> DBMI-DBF driver error:
> Column 'cat_' already exists (duplicate name)
> Cannot create table.
> Error in db_execute_immediate()
>
> No good.
>
> My idea is that any time 'CAT' or 'cat' is present in the input, a warning
> and instruction should be issued like:
>
> "A column named 'CAT' or 'cat' is present in your input data. This column is
> RESERVED for Grass to store "categories". Read more here: (a link to where
> the user he can read more about what "categories" in Grass are; but is there
> such a place?). Please rename your 'CAT' or 'cat' using the cnames option in
> v.in.ogr to override conflicting column name."
>
> What do you think?
>
> The other, automated, solution could be to rename 'cat' to, say, 'cat1'. And
> if 'cat1' is present to 'cat2' etc. Same with 'CAT'. Any good?
>
> Maciek
>
> P.S.
> I mean this solutions mainly to help Grass newbies. I imagine that could be
> quite a surprise for a newbie to read "Column 'CAT' already exists
> (duplicate name)" with no guiding why so and what to do with it to able to
> import his shapefile anyway. But maybe I'm just exagerating here. You
> decide. I'll complain ;).
>
More information about the grass-dev
mailing list