[GRASS-dev] v.dissolve not working with string column

Markus Metz markus.metz.giswork at googlemail.com
Wed Apr 4 03:49:13 EDT 2012


On Wed, Apr 4, 2012 at 8:11 AM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 04/04/12 07:56, Michael Barton wrote:
>>
>> I'm trying to do a dissolve but keep getting an error saying that it
>> only works with integer or string columns. But the column I'm using for
>> the dissolve IS string.
>>
>> GRASS 7.0.svn (Spain_utm_wgs84z30):~ > db.describe table=muro_temp
>> table:muro_temp
>> description:
>> insert:?
>> delete:?
>> ncols:4
>> nrows:177
>>
>> column:cat
>> description:
>> type:INTEGER
>> len:20
>> scale:0
>> precision:0
>> default:
>> nullok:yes
>> select:?
>> update:?
>>
>> column:Subsector
>> description:
>> type:TEXT
>> len:1000
>> scale:0
>> precision:0
>> default:
>> nullok:yes
>> select:?
>> update:?
>>
>> column:valley
>> description:
>> type:TEXT
>> len:1000
>> scale:0
>> precision:0
>> default:
>> nullok:yes
>> select:?
>> update:?
>>
>> column:sector
>> description:
>> type:TEXT
>> len:1000
>> scale:0
>> precision:0
>> default:
>> nullok:yes
>> select:?
>> update:?
>>
>>
>> GRASS 7.0.svn (Spain_utm_wgs84z30):~ > v.dissolve input=muro_temp
>> column=sector output=muro_sectors3
>> ERROR: Key column must be of type integer or string
>> GRASS 7.0.svn (Spain_utm_wgs84z30):~ >
>>
>>
>> Note above that the column "sector" IS text.
>>
>> So what is wrong?
>
>
> v.dissolve checks for integer and character, but not for text.
>
> Try this simple patch:
>
> --- v.dissolve.py       2011-08-17 13:49:29.000000000 +0200
> +++ v.dissolve.new.py   2012-04-04 08:04:00.000000000 +0200
> @@ -66,7 +66,7 @@
>         except KeyError:
>             grass.fatal(_('Column <%s> not found') % column)
>
> -       if coltype['type'] not in ('INTEGER', 'CHARACTER'):
> +       if coltype['type'] not in ('INTEGER', 'CHARACTER', 'TEXT'):
>            grass.fatal(_("Key column must be of type integer or string"))
>
>         f = grass.vector_layer_db(input, layer)
>

I have committed the patch and also added SMALLINT as valid integer in r51246.

Markus M


More information about the grass-dev mailing list