[GRASS-dev] v.extract and sqlite-db

Stephan Holl holl at gdf-hannover.de
Wed Aug 2 07:32:20 EDT 2006


Dear devs,

playing with sqlite as attribute-storage I found out, that the ID needs
to be an integer. I tried with this[1] sample
spearfish-sqlite-attributedb which has a 'numeric' type for ID.

v.db.connect does not complain as long as you do not use v.extract with
a where-statement to extract parts of your data.
The resulting dataset is broken afterwards.

To reproduce in spearfish60:
wget [1]
g.copy vect=soils at PERMANENT,soils_cp
v.db.connect -o map=soils_cp table=soils_legend
database=./soils_legend.db driver=sqlite key=id

v.db.select soils_cp|head
id|shortname|longname
0.000000|no data|no data
1.000000|AaB|Alice fine sandy loam, 0 to 6
...

v.extract in=soils_cp out=soils_steep type=area where="longname LIKE
'%steep%'"
Load cats from the database (table = soils_legend, db
= ./soils_legend.db). 5 cats loaded from the database
Building topology ...
194 primitives registered
Building areas:  100%
39 areas built
16 isles built
Attaching islands:  100%
Attaching centroids:  100%
Topology was built.
Number of nodes     :   171
Number of primitives:   194
Number of points    :   0
Number of lines     :   0
Number of boundaries:   164
Number of centroids :   30
Number of areas     :   39
Number of isles     :   16
Number of areas without centroid :   9
Writing attributes ...
Layer 1
ERROR: Column 'id' is not integer
GRASS 6.1.cvs (spearfish60):

v.info soils_steep
ERROR: Cannot open old vector soils_steep at lausanne_db on level 2

I would suggest, that the driver does not create the dataset, if the
id-column is a non-integer.

Using a table with an int id-column works fine though.

Best

	Stephan

[1] http://mpa.itc.it/grasstutor/scripts/soils_legend.db

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




More information about the grass-dev mailing list