[GRASS-user] v.in.ogr with "cnames"-option (little help needed)

Hi list,
I would like to import a shapefile using v.in.ogr together with the "cnames" option to rename some of the columns.

The column names ID_NR, KAT_ID, NAME, SUBNAME, ADRESSE, PLZ, RECHTSWERT
should be renamed to id,kat,name,subn,adresse,plz,x,y

Therefore, I wrote:
GRASS 6.1.cvs (muc_intra):~ > v.in.ogr -o cnames=cat,kat,name,subn,adresse,plz,x,y dsn=./ layer=places out=places_mod

However, the new colum names are wrong (and I fear that I just do not correctly understand, how I have to use this cnames-command)

GRASS says:
Over-riding projection check.
Proceeding with import...
Layer: biergAE
WARNING: Column name changed: 'ID_NR' -> 'kat'
WARNING: Column name changed: 'KAT_ID' -> 'name'
WARNING: Column name changed: 'NAME' -> 'subn'
WARNING: Column name changed: 'SUBNAME' -> 'adresse'
WARNING: Column name changed: 'ADRESSE' -> 'plz'
WARNING: Column name changed: 'PLZ' -> 'x'
WARNING: Column name changed: 'RECHTSWERT' -> 'y'
Importing map 59 features...

Any tips will be greatly appreciated!

Best regards,
Wolfgang

--
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

On Thu, 2006-09-28 at 17:19 +0200, Wolfgang Qual wrote:

Hi list,
I would like to import a shapefile using v.in.ogr together with the "cnames" option to rename some of the columns.

The column names ID_NR, KAT_ID, NAME, SUBNAME, ADRESSE, PLZ, RECHTSWERT
should be renamed to id,kat,name,subn,adresse,plz,x,y

Therefore, I wrote:
GRASS 6.1.cvs (muc_intra):~ > v.in.ogr -o cnames=cat,kat,name,subn,adresse,plz,x,y dsn=./ layer=places out=places_mod

However, the new colum names are wrong (and I fear that I just do not correctly understand, how I have to use this cnames-command)

GRASS says:
Over-riding projection check.
Proceeding with import...
Layer: biergAE
WARNING: Column name changed: 'ID_NR' -> 'kat'
WARNING: Column name changed: 'KAT_ID' -> 'name'
WARNING: Column name changed: 'NAME' -> 'subn'
WARNING: Column name changed: 'SUBNAME' -> 'adresse'
WARNING: Column name changed: 'ADRESSE' -> 'plz'
WARNING: Column name changed: 'PLZ' -> 'x'
WARNING: Column name changed: 'RECHTSWERT' -> 'y'
Importing map 59 features...

Add another column to 'cnames' before cat (like idnr, etc.). The
columns are off by one.

--
Brad Douglas <rez touchofmadness com> KB8UYR
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785

Hi Brad, list,
thanks alot! It worked.@list: would it be possible to add an example for this command to the grass-manual - would be very helpful

Best regards,
Wolfgang
--
-------- Original-Nachricht --------
Datum: Thu, 28 Sep 2006 10:59:12 -0700
Von: Brad Douglas <rez@touchofmadness.com>
An: Wolfgang Qual <Wolfgang.Qual@gmx.net>
Betreff: Re: [GRASS-user] v.in.ogr with "cnames"-option (little help needed)

On Thu, 2006-09-28 at 17:19 +0200, Wolfgang Qual wrote:
> Hi list,
> I would like to import a shapefile using v.in.ogr together with the
"cnames" option to rename some of the columns.
>
> The column names ID_NR, KAT_ID, NAME, SUBNAME, ADRESSE, PLZ, RECHTSWERT
> should be renamed to id,kat,name,subn,adresse,plz,x,y
>
> Therefore, I wrote:
> GRASS 6.1.cvs (muc_intra):~ > v.in.ogr -o
cnames=cat,kat,name,subn,adresse,plz,x,y dsn=./ layer=places out=places_mod
>
> However, the new colum names are wrong (and I fear that I just do not
correctly understand, how I have to use this cnames-command)
>
> GRASS says:
> Over-riding projection check.
> Proceeding with import...
> Layer: biergAE
> WARNING: Column name changed: 'ID_NR' -> 'kat'
> WARNING: Column name changed: 'KAT_ID' -> 'name'
> WARNING: Column name changed: 'NAME' -> 'subn'
> WARNING: Column name changed: 'SUBNAME' -> 'adresse'
> WARNING: Column name changed: 'ADRESSE' -> 'plz'
> WARNING: Column name changed: 'PLZ' -> 'x'
> WARNING: Column name changed: 'RECHTSWERT' -> 'y'
> Importing map 59 features...

Add another column to 'cnames' before cat (like idnr, etc.). The
columns are off by one.

--
Brad Douglas <rez touchofmadness com> KB8UYR
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785

--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

Hello Wolfgang,

On Fri, 29 Sep 2006 10:17:41 +0200 "Wolfgang Qual"
<Wolfgang.Qual@gmx.net> wrote:

Hi Brad, list,
thanks alot! It worked.@list: would it be possible to add an example
for this command to the grass-manual - would be very helpful

@wolfgang: if you provide your working example as text-snippet I am
happy to add it to the manual!

Cheers

  Stephan

Best regards,
Wolfgang
--
-------- Original-Nachricht --------
Datum: Thu, 28 Sep 2006 10:59:12 -0700
Von: Brad Douglas <rez@touchofmadness.com>
An: Wolfgang Qual <Wolfgang.Qual@gmx.net>
Betreff: Re: [GRASS-user] v.in.ogr with "cnames"-option (little help
needed)

> On Thu, 2006-09-28 at 17:19 +0200, Wolfgang Qual wrote:
> > Hi list,
> > I would like to import a shapefile using v.in.ogr together with
> > the
> "cnames" option to rename some of the columns.
> >
> > The column names ID_NR, KAT_ID, NAME, SUBNAME, ADRESSE, PLZ,
> > RECHTSWERT should be renamed to id,kat,name,subn,adresse,plz,x,y
> >
> > Therefore, I wrote:
> > GRASS 6.1.cvs (muc_intra):~ > v.in.ogr -o
> cnames=cat,kat,name,subn,adresse,plz,x,y dsn=./ layer=places
> out=places_mod
> >
> > However, the new colum names are wrong (and I fear that I just do
> > not
> correctly understand, how I have to use this cnames-command)
> >
> > GRASS says:
> > Over-riding projection check.
> > Proceeding with import...
> > Layer: biergAE
> > WARNING: Column name changed: 'ID_NR' -> 'kat'
> > WARNING: Column name changed: 'KAT_ID' -> 'name'
> > WARNING: Column name changed: 'NAME' -> 'subn'
> > WARNING: Column name changed: 'SUBNAME' -> 'adresse'
> > WARNING: Column name changed: 'ADRESSE' -> 'plz'
> > WARNING: Column name changed: 'PLZ' -> 'x'
> > WARNING: Column name changed: 'RECHTSWERT' -> 'y'
> > Importing map 59 features...
>
> Add another column to 'cnames' before cat (like idnr, etc.). The
> columns are off by one.
>
>
> --
> Brad Douglas <rez touchofmadness com> KB8UYR
> Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

Hi Stephan,
here's my example (maybe too much text :wink: )

1) find out, what the column names of the shapefile are:

ogrinfo -al testfile.shp|less
and I get:

INFO: Open of `testfile.shp'
using driver `ESRI Shapefile' successful.
[...]
ID_NR: Integer (3.0)
KAT_ID: Integer (5.0)
NAME: String (80.0)
SUBNAME: String (40.0)
ADRESSE: String (90.0)
PLZ: String (5.0)
RECHTSWERT: Integer (7.0)
HOCHWERT: Integer (7.0)

2)I would like to replace the colum names like this:
ID_NR --> id
KAT_ID --> kat
NAME --> name
SUBNAME --> subn
ADRESSE -->address
PLZ -->plz
RECHTSWERT --> x
HOCHWERT --> y

3)The command for this would be (note that I have to add an additional name for the cat-column that will be added by GRASS):
GRASS 6.1.cvs (muc_intra):~ > v.in.ogr -o cnames=cat,id_nr,kat,name,subn,adresse,plz,x,y dsn=./ layer=testfile out=test_mod

GRASS says:
Over-riding projection check.
Proceeding with import...
Layer: test_mod
WARNING: Column name changed: 'ID_NR' -> 'id_nr'
WARNING: Column name changed: 'KAT_ID' -> 'kat'
WARNING: Column name changed: 'NAME' -> 'name'
WARNING: Column name changed: 'SUBNAME' -> 'subn'
WARNING: Column name changed: 'ADRESSE' -> 'adresse'
WARNING: Column name changed: 'PLZ' -> 'plz'
WARNING: Column name changed: 'RECHTSWERT' -> 'x'
WARNING: Column name changed: 'HOCHWERT' -> 'y'

4)Everything ok!

If you want to change only one column name, you'll still have to mention the other column names in the "cnames"-command, e.g.
Only change KAT_ID to kat:

v.in.ogr -o cnames=cat,ID_NR,kat,NAME,SUBNAME,ADRESSE,PLZ,RECHTSWERT,HOCHWERT dsn=./ layer=testfile out=test_mod

Best regards,
Wolfgang

---
-------- Original-Nachricht --------
Datum: Fri, 29 Sep 2006 10:39:50 +0200
Von: Stephan Holl <holl@gdf-hannover.de>
An: grassuser@grass.itc.it
Betreff: Re: [GRASS-user] v.in.ogr with "cnames"-option (little help needed)

Hello Wolfgang,

On Fri, 29 Sep 2006 10:17:41 +0200 "Wolfgang Qual"
<Wolfgang.Qual@gmx.net> wrote:

> Hi Brad, list,
> thanks alot! It worked.@list: would it be possible to add an example
> for this command to the grass-manual - would be very helpful

@wolfgang: if you provide your working example as text-snippet I am
happy to add it to the manual!

Cheers

  Stephan

>
> Best regards,
> Wolfgang
> --
> -------- Original-Nachricht --------
> Datum: Thu, 28 Sep 2006 10:59:12 -0700
> Von: Brad Douglas <rez@touchofmadness.com>
> An: Wolfgang Qual <Wolfgang.Qual@gmx.net>
> Betreff: Re: [GRASS-user] v.in.ogr with "cnames"-option (little help
> needed)
>
> > On Thu, 2006-09-28 at 17:19 +0200, Wolfgang Qual wrote:
> > > Hi list,
> > > I would like to import a shapefile using v.in.ogr together with
> > > the
> > "cnames" option to rename some of the columns.
> > >
> > > The column names ID_NR, KAT_ID, NAME, SUBNAME, ADRESSE, PLZ,
> > > RECHTSWERT should be renamed to id,kat,name,subn,adresse,plz,x,y
> > >
> > > Therefore, I wrote:
> > > GRASS 6.1.cvs (muc_intra):~ > v.in.ogr -o
> > cnames=cat,kat,name,subn,adresse,plz,x,y dsn=./ layer=places
> > out=places_mod
> > >
> > > However, the new colum names are wrong (and I fear that I just do
> > > not
> > correctly understand, how I have to use this cnames-command)
> > >
> > > GRASS says:
> > > Over-riding projection check.
> > > Proceeding with import...
> > > Layer: biergAE
> > > WARNING: Column name changed: 'ID_NR' -> 'kat'
> > > WARNING: Column name changed: 'KAT_ID' -> 'name'
> > > WARNING: Column name changed: 'NAME' -> 'subn'
> > > WARNING: Column name changed: 'SUBNAME' -> 'adresse'
> > > WARNING: Column name changed: 'ADRESSE' -> 'plz'
> > > WARNING: Column name changed: 'PLZ' -> 'x'
> > > WARNING: Column name changed: 'RECHTSWERT' -> 'y'
> > > Importing map 59 features...
> >
> > Add another column to 'cnames' before cat (like idnr, etc.). The
> > columns are off by one.
> >
> >
> > --
> > Brad Douglas <rez touchofmadness com> KB8UYR
> > Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785
>

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer