On 05/08/2011 01:28 AM, rvanderwe...@worldbank.org wrote:

Dear GRASS users,

 

I keep on getting SQLite driver errors when trying to use a newly created SQLite database ('unable to open database'). By default, GRASS starts up connected to DBF. Connecting to an SQLite database works fine (when the database does not yet exist, it seems to create an empty database).


No I think that no database is created. It seems you have to do that manually, then the import and copy will work:


GRASS 6.4.0 (UTM36):~ > db.connect -p
driver:dbf
database:$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
schema:
group:
GRASS 6.4.0 (UTM36):~ > eval `g.gisenv`
GRASS 6.4.0 (UTM36):~ > db.connect driv=sqlite database=$GISDBASE/$LOCATION_NAME/$MAPSET/geodata.db
GRASS 6.4.0 (UTM36):~ > db.connect -p
driver:sqlite
database:/home/micha/geodata/grass/UTM36/Israel/geodata.db
schema:
group:

GRASS 6.4.0 (UTM36):~ > ll /home/micha/geodata/grass/UTM36/Israel/geodata.db
ls: cannot access /home/micha/geodata/grass/UTM36/Israel/geodata.db: No such file or directory



Note that no sqlite.db exists yet, so I do:


GRASS 6.4.0 (UTM36):~ > sqlite3 /home/micha/geodata/grass/UTM36/Israel/geodata.db
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table temp (label varchar(16));
sqlite> .quit
GRASS 6.4.0 (UTM36):~ > ll /home/micha/geodata/grass/UTM36/Israel/geodata.db
-rw-r--r-- 1 micha micha 2048 2011-05-08 07:48 /home/micha/geodata/grass/UTM36/Israel/geodata.db


A minor annoyance, I guess. But if you think of sqlite as a database like PostgreSQL you wouldn't expect GRASS to create a PostgreSQL database automatically ...



So far so good. Problems emerge however when i next wish to import a shapefile, OR copy an attribute table from a shapefile that was previously imported using the DBF driver. I recall that an earlier version of GRASS 6.4 used SQLite as the default driver. With this version, all worked well, i.e. i did NOT have the problems described below.

 

Let me attach the command lines for both examples:

 

(1) Problem importing shapefile while connected to a SQLite database:

 

GRASS 6.4> db.connect driver=sqlite database="c:\Test\sqlite.db"
GRASS 6.4> v.in.ogr dsn=C:\Test\pse.shp layer=pse output=pse                              
Datum <Palestine_1923> not recognised by GRASS and no parameters found
Projection of input dataset and current location appear to match
Layer: pse
DBMI-SQLite driver error:
Unable to open database: unable to open database file
Unable to open database <c:\test\sqlite.db> by driver <sqlite>
ERROR: Unable open database <c:\test\sqlite.db> by driver <sqlite>
(Fri May 06 13:33:01 2011) Command finished (0 sec)

 

(2) Problem copying attribute table (imported in DBF) to SQLite database):

 

GRASS 6.4> db.connect driver=sqlite database="c:\Test\sqlite.db"
GRASS 6.4> g.copy vect=pse@pov4,pse_sqlite
Copy vector <pse@pov4> to current mapset as <pse_sqlite>
DBMI-SQLite driver error:
Unable to open database: unable to open database file

WARNING: Unable to open database <sqlite> by driver <c:\Test\sqlite.db>
no database is open
WARNING: Unable to copy table <pse_sqlite>
WARNING: Cannot copy <pse@pov4> to current mapset as <pse_sqlite>

 

 

(*) What am i doing wrong -- What is the easiest way of fixing both of these problems??

 

 

Many thanks in advance,

 

Roy


This mail was received via Mail-SeCure System.
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.




-- 
Micha Silver
Arava Development Co. +972-52-3665918
http://www.surfaces.co.il
 
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to