[GRASS-user] v.dissolve renames the attribute column

Markus Metz markus.metz.giswork at googlemail.com
Tue May 29 04:07:04 PDT 2012


Moritz Lennert wrote:
> On 28/05/12 12:30, Markus Metz wrote:
>>
>> On Mon, May 28, 2012 at 11:52 AM, spiderplant0<spiderplant0 at gmail.com>
>>  wrote:
>>>
>>> Hi. It doesn't add any new information but I wanted the .dbf file to be
>>> there
>>> so I can open it up with other tools and check the contents for debug
>>> purposes etc. And I wanted to change the column to the correct name for
>>> consistency with downstream processing scripts.
>>
>>
>> Try
>> v.dissolve input=pass2 at mapset1 layer=1 column=fttcp output=pass3
>> v.db.addtable map=pass3
>> v.db.renamecol map=pass3 column=cat,fftcp
>
>
> IIUC, if you do that you will lose the connection between the map and the
> attribute table if that connection is defined with the cat column as the key
> column.

Oops, right, thanks for pointing this out.

Markus

>
> If you want to keep the connection, but use the name fftcp instead of cat
> for the key column, you will have to do something like this:
>
>
> v.dissolve input=pass2 at mapset1 layer=1 column=fttcp output=pass3
> v.db.addtable map=pass3
> v.db.addcolumn map=pass3 col="fftcp int"
> v.db.update map=pass3 col=fftcp qcolumn=cat
> v.db.connect -o map=pass3 table=pass3 key=fftcp
> v.db.dropcolumn map=pass3 col=cat
>
>
>
>>
>> If you want that to be done by v.dissolve, that is, v.reclass,
>> automatically, you could file an enhancement ticket for v.reclass to
>> add a new flag, say -t, to always create a table for the output where
>> the original column name is used when the column type is integer.
>
>
> Maybe adding the option to v.db.addtable to use another name for the key
> column would also be good idea.
>
> Moritz


More information about the grass-user mailing list