[GRASSLIST:8819] Re: switching to postgres
Brent Wood
b.wood at niwa.co.nz
Sun Oct 30 18:05:42 EST 2005
Another way I have loaded dbf data into Postgres tables is to use the
dbfdump program from the shapelib utilities to extract the dbf fields &
data, the run a script to parse these, create the table & load the data.
see
http://shapelib.maptools.org/shapelib-tools.html#dbfdump
for details on the shpdump command. (You don't need the shapefile, just
the dbf. Use ogr2ogr or shp2psql from Postgis if you need to load the full
spatial dataset)
Brent Wood
On Fri, 28 Oct 2005, Stephan Holl wrote:
> Hello Kirk,
>
> On Thu, 27 Oct 2005 13:23:23 -0500 "Kirk R. Wythers" <kwythers at umn.edu>
> wrote:
>
> > When switching from dbf to postgresql, besides these steps:
> >
> > PostgreSQL database
> >
> > To (re)set GRASS to connect to PostgreSQL, run:
> >
> >
> > #define database settings:
> > db.connect driver=pg database="host=myserver.itc.it,dbname=mydb"
> >
> > #define login settings:
> > db.login user=myname pass=secret
> >
> > #list available tables
> > db.tables -p
> >
> >
> > Do the database and tables need to be created in with CREATE
> > DATABASE and CREATE TABLE in postgresql before you set the connection
> > with db.connect and v.db.connect?
>
> AFAIK the database needs to be created before. If you would just
> copying your existing tables to PG, you should consider using db.copy
> and reconnect the newly created tables in PG with your dataset (with
> v.db.connect)
>
> >
> > Also, for some reason, the host argument on my system only seems to
> > work if I use "host=localhost". Is that ok?
>
> I think this depends on your PG-configuration, but I am not sure. Check
> your pg_hba.conf for this.
>
> Best
> Stephan
>
>
> --
> 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-user
mailing list