[GRASS-user] v.colors usage
Markus Metz
markus.metz.giswork at gmail.com
Tue Nov 6 23:53:56 PST 2018
On Tue, Nov 6, 2018 at 11:57 PM Rich Shepard <rshepard at appl-ecosys.com>
wrote:
>
> On Tue, 6 Nov 2018, Markus Metz wrote:
>
> > 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.
>
> Markus M,
>
> I did not realize this. I thought that using db.connect with the pg
driver
> would use that table exclusively. This is good to know.
>
> > db.connect as well as other db.* commands use the default database
> > connection reported by db.connect -p unless specified, e.g.
>
> Well, it didn't here when I tried using the v.colors command. :-(
>
> > 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.
>
> I had used db.copy to copy all the stations map tables to postgres
except
> for the stations table because that existed first in the postgres
database,
> and attributes there were expoorted and used with v.in.ascii to create the
> grass map.
>
> Changing the database connection to the sqlite default I thought the
> stations table was deleted:
>
> > db.droptable -f driver=sqlite table=stations
I suggested v.db.droptable, not db.droptable. db.* commands work on
databases whereas v.* commands work on vectors. Thus you need to use
v.db.connect, not db.connect, to connect a table to a vector, e.g.:
v.db.connect map=stations driver=pg database="willamette-river-hg"
table=stations layer=1
HTH,
Markus M
> Forcing ...
> WARNING: Deleting table <stations> which is attached to following map(s):
> WARNING: stations at mercury
>
> but,
>
> > db.connect driver=pg database="willamette-river-hg"
> GRASS 7.7.svn (willamette_basin):~/data/grassdata/willamette_basin >
db.connect -p
> driver: pg
> database: willamette-river-hg
>
> > v.colors -c map=stations use=attr column=howmany rules=rules.txt
rgb_col=bin_col --o
> DBMI-SQLite driver error:
> Error in sqlite3_prepare(): select * from stations where oid < 0
> no such table: stations
>
> DBMI-SQLite driver error:
> Error in sqlite3_prepare(): select * from stations where oid < 0
> no such table: stations
>
> ERROR: Column <howmany> not found in table <stations>
>
> > db.connect -p driver: pg database: willamette-river-hg schema: group:
> GRASS 7.7.svn (willamette_basin):~/data/grassdata/willamette_basin
>
> > 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>
>
> So, grass tells me it dropped the sqlite database table, but it still
> looks for it when I run v.colors. I suppose I need to manually change the
> database type.
>
> Regards,
>
> 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/20181107/a2625b15/attachment.html>
More information about the grass-user
mailing list