[GRASS-user] Finding why postgres database cannot be opened

Markus Metz markus.metz.giswork at gmail.com
Thu Nov 8 00:37:58 PST 2018


On Wed, Nov 7, 2018 at 11:45 PM Rich Shepard <rshepard at appl-ecosys.com>
wrote:
>
> On Wed, 7 Nov 2018, Rich Shepard wrote:
>
> > Almost all issues are now resolved,
>
>    The issues with specifying database paths and needing a filled cat
column
> in the stations table have been resolved. v.db.connect shows a valid
> connection to the database table:

It's not resolved, and it is not a valid connection:
>
> > v.db.connect map=stations -p
> Vector map <stations> is connected by:
> layer <1/stations> table <stations> in database
> </home/rshepard/data/grassdata/willamette_basin/willamette-river-hg>
through
> driver <pg> with key <cat>

for driver=pg, the database must not be a path, it must be
database=willamette-river-hg

Also, be aware of the differences between db.connect and v.db.connect. The
pg database willamette-river-hg must have been established first with
db.connect + db.login, only after that you can use v.db.connect which is
not needed for newly created vectors.

Markus M
>
> but, trying to display that map using v.colors in a script still fails to
> find the database:
>
> >
$HOME/documents/white-papers/geochemistry/willamette-river-mercury/scripts/grass-display-sample-sites.sh
> d.vect complete.
> d.vect complete.
> DBMI-PostgreSQL driver error:
> Connection failed.
> FATAL:  database
"/home/rshepard/data/grassdata/willamette_basin/willamette-river" does not
exist
> WARNING: Unable to open database
>
</home/rshepard/data/grassdata/willamette_basin/willamette-river-hg>
>           by driver <pg>
> ERROR: Unable to open database
>
</home/rshepard/data/grassdata/willamette_basin/willamette-river-hg>
>         by driver <pg>
>
>    The script:
> #!/usr/bin/bash
>
> db.connect driver=pg database=willamette-river-hg
> g.region vect=wrb
> d.mon start=wx0
> d.vect map=wrb col=black fill_col=none
> d.vect map=wrb_rivers col=blue fill_col=blue
> v.colors map=stations use=attr column=howmany rules=rules.txt
rgb_col=bin_col --o
>
> and the color rules file:
>
> 1 231:00:00
> 10 231:00:00
> 11 89:00:00
> 20 89:00:00
> 21 231:00:231
> 30 231:00:231
> 31 231:173:00
> 40 231:173:00
> 41 231:115:00
> 50 231:115:00
> 51 00:231:57
> 60 00:231:57
> 61 115:231:00
> 70 115:231:00
>
> TIA,
>
> Rich
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20181108/4da92c66/attachment.html>


More information about the grass-user mailing list