[GRASSLIST:8971] Re: sqlite and v.rast.stats problem

Markus Neteler neteler at itc.it
Thu Nov 10 06:32:12 EST 2005


David,

sorry, a test was not written correctly. I have fixed that.
Now it works also for DB drivers other than dbf.

Please fetch from 6.1-CVS:

 http://freegis.org/cgi-bin/viewcvs.cgi/grass6/scripts/v.rast.stats/

or from next weekend's snapshot. The minimum change is

-  echo "ERROR: Cannot continue (use v.db.addtable first)."
-  exit 1
+  # in case a table is missing, we'll trap a crash later...
+  DBFDRIVER=0

Thanks for notifying,

Markus


On Wed, Nov 09, 2005 at 04:33:23PM -0800, David Finlayson wrote:
> I am trying to calculate statistics for a raster DEM (PSDEM2005) using
> the features in a vector coverage (blocksall). The vector contains a
> series of blocks, each with a unique cat. I have stored the attribute
> table in an sqlite3 database and according to v.db.connect it is
> linked (I can also query and display attributes in this table using
> d.vect):
> 
> GRASS 6.1.cvs (WASPN_NAD83):~ > v.db.connect -p blocksall
> Vector map <blocksall> is connected by:
> layer <1> table <blocksall> in database
> </data/grass/WASPN_NAD83/hood/sqlite.db> through driver <sqlite> with
> key <cat>
> 
> However, when I run v.rast.stats. I get an error asking me to run v.db.addtable:
> 
> GRASS 6.1.cvs (WASPN_NAD83):~ > v.rast.stats -c vector=blocksall 
> raster=psdem2005 colprefix=elev30ft
> List of categories found: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
> 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
> 42 43 44 45 46 47 48 ... <clipped> ...
> 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630
> 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
> 648 649
> ERROR: Cannot continue (use v.db.addtable first).
> 
> I expected that v.rast.stats would have calculated statistics and
> created columns in the sqlite database. This has worked using dbf
> tables for me in the past. I am forgetting something here?
> 
> Thanks,
> 
> David
> --
> David Finlayson
> Marine Geology & Geophysics
> School of Oceanography
> Box 357940
> University of Washington
> Seattle, WA  98195-7940
> USA
> 
> Office: Marine Sciences Building, Room 112
> Phone: (206) 616-9407
> Web: http://students.washington.edu/dfinlays
> 

-- 
Markus Neteler     <neteler itc it>       http://mpa.itc.it
ITC-irst -  Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18        -       38050 Povo (Trento), Italy




More information about the grass-user mailing list