[GRASSLIST:5391] Re: vectors connection to pg tables

Francesco Mirabella mirabell at unipg.it
Mon Jan 17 10:16:58 EST 2005


hi Radim,
thanks for your answer, well:

after importing into grass with v.in.ascii I have a database connection
after running db.connect and v.db.connect (if not, I get no database
connection) , but there is some problem as I d.what.vect gives:

D2/3: Form: html = <HTML><HEAD><TITLE>Form</TITLE><BODY>map:
'prova_sismi_again'<BR>mapset: 'PERMANENT'<BR>feature type:
Point<BR>Point height: 6.330000<BR><HR><BR>Layer: 1<BR>category:
50<BR>driver: pg<BR>database:
host=localhost,dbname=cesco_pgsql,user=mirabell<BR>table:
prova_sismi_again<BR>key column: cat<BR>Cannot open select
cursor:<BR>'select * from prova_sismi_again where cat = 50'<BR>on
database 'host=localhost,dbname=cesco_pgsql,user=mirabell' by driver
'pg'<BR></BODY></HTML>
D2/3: PARENT: received O

D2/3: Form displayed


Note that at this stage, pgaccess does not see any table yet even if the
info are in the form.

So, to answer your question, no, db.execute does not tell that the table exists.

After running db.execute, db.connect etc.. as I wrote this morning, the
form is correct, i.e. the errors above disappear, the table exists (of
course) but no data are present in the table when I access it with pgaccess. So I cannot change data within the table after importing the data.

thanks again
cheers,
Francesco






On Mon, Jan 17, 2005 at 12:59:01PM +0100, Radim Blazek wrote:
> The v.in.ascii should do that all, i.e. no more db. v.db. modules.
> I think that db.execute told you that the table exists?
> 
> Radim
> 
> Francesco Mirabella wrote:
> >dear users,
> >
> >I have a probelm with vectors and database connections:
> >
> >I have set up grass60 beta 1
> >
> >after importing an ascii 3d map points with v.in.ascii:
> >
> ><v.in.ascii -z input=LatLon_AC.dat output=prova_sismi  fs=tab  columns='x 
> >double precision, y double precision, z double precision, cat int'  x=2 
> >y=3 z=4 cat=1>
> >
> >I would like to link it to my postgres database. 
> >
> >Following the instructions in html man pages I think I first need to 
> >create the table to which I want to link the vector map (or maybe not?)
> >
> ><echo 'create table tabella_sismi ("cat" int, "lat" double precision, 
> >"long" double precision, "depth" double precision)' | db.execute> 
> >then I connect the database:
> ><db.connect driver=pg 
> >database="host=localhost,dbname=database,user=database_user">
> >
> >I connect to the database:
> ><db.login>
> >
> >And finally I connect the vector map "prova_sismi" to the table
> >"tabella_sismi" through postgres:
> ><v.db.connect map=prova_sismi table=tabella_sismi driver=pg 
> >database="host=localhost,dbname=database,user=database_user" -o
> >
> >Now,
> >when I query the map <d.what.vect> the form is very good, the
> >information is correct both regarding table name,database name and data.
> >However if I access the tabel through e.g. pgacces, the table exists but
> >no data are displayed.
> >
> >am I doing something wrong??
> >
> >thanks for your help
> >
> >Francesco
> 




More information about the grass-user mailing list