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?
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
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)
Moritz
On Wed, Apr 4, 2012 at 8:11 AM, Moritz Lennert
<mlennert@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
Thanks very much. For sqlite, there is no field type called "character". I tried changing the field type to varchar, but that didn't work either.
Michael
On Apr 4, 2012, at 1:49 AM, Markus Metz wrote:
On Wed, Apr 4, 2012 at 8:11 AM, Moritz Lennert
<mlennert@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
_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
On Wed, Apr 4, 2012 at 4:58 PM, Michael Barton <Michael.Barton@asu.edu> wrote:
Thanks very much. For sqlite, there is no field type called "character".
... but there is TEXT. Please post
v.info -c muro_temp
thanks
markusN
Right! That's the problem.
v.info -c muro_temp
Displaying column types/names for database connection of layer <1>:
INTEGER|cat
TEXT|Subsector
TEXT|valley
TEXT|sector
GRASS 7.0.svn (Spain_utm_wgs84z30):~ >
I want to dissolve on sector, but it complains that this is not a "string".
Michael
On Apr 4, 2012, at 9:05 AM, Markus Neteler wrote:
On Wed, Apr 4, 2012 at 4:58 PM, Michael Barton <Michael.Barton@asu.edu> wrote:
Thanks very much. For sqlite, there is no field type called "character".
... but there is TEXT. Please post
v.info -c muro_temp
thanks
markusN
_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
Michael Barton wrote:
I want to dissolve on sector, but it complains that this is not a "string".
This is still happening in trunk r51246?
Markus M