[GRASS-user] v.colors usage

Markus Metz markus.metz.giswork at gmail.com
Tue Nov 6 13:50:15 PST 2018


On Tue, Nov 6, 2018 at 10:34 PM Rich Shepard <rshepard at appl-ecosys.com>
wrote:
>
> On Tue, 6 Nov 2018, Markus Metz wrote:
>
> > Please check v.db.connect map=stations -p
> > and
> > db.connect -p
> > Is the table attached to the map stations really in the default
database?
>
> Markus M,
>
> > db.connect -p
> driver: pg
> database: willamette-river-hg
> schema: group:
>
>    Well, well, well. Here's the problem:
>
> > 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/mercury/sqlite/sqlite.db>
> through driver <sqlite> with key <cat>
>
>    How can stations be seen in the default sqlite database when db.connect
> shows the table in the postgres database? What else is db.connect doing if
> it allows grass commands to ignore what it reports and defaults to the
> sqlite one?

Apparently the table (not the vector map) stations exists twice: once in
the sqlite database, once in the pg willamette-river-hg database. This is
the reason for the confusion.

A vector map can have a table that is not in the default database as
reported by db.connect -p.
>
>    I thought db.connect used the database to which it reported being
> connected.

db.connect as well as other db.* commands use the default database
connection reported by db.connect -p unless specified, e.g.

db.describe tab=stations driver=sqlite
database=/home/rshepard/data/grassdata/willamette_basin/mercury/sqlite/sqlite.db

>
>    How do I remove the sqlite stations table so grass sees it in the
> connected postgres database?

You have to change the database connection for a given vector map with
v.db.connect. To be safe (avoiding confusion) you might use v.db.droptable
first. Make sure you transfer attribute values first, e.g. with db.copy.

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20181106/304d5d30/attachment.html>


More information about the grass-user mailing list