[GRASS-user] tables connection in database
Moritz Lennert
mlennert at club.worldonline.be
Fri Jun 26 05:03:29 EDT 2009
On 23/06/09 17:42, Falko Engel wrote:
> Dear List,
>
> I have some problems with tables stored in PostgreSQL database.
> I'm using openSUSE 11.1 (and 10.3), PostgreSQL 8.2.13 and GRASS GIS 6.4.0RC4
> My default db connection for my mapsets is set to postgresql.
> I am using schemas within the database corresponding to the mapsets. So
> my mapset "forest" has a corresponding schema "forest" in the database
> where all the forest-tables should be stored.
>
> Problem 1:
> After dissolving with v.extract -d using the new= parameter I tried to
> use v.db.addtable to create a table for my dissolved map. This has to be
> done, as far as I understood, since the new= parameter of v.extract
> results in maps without tables.
> Now v.db.addtable creates the table, but doesn't put it in the right
> database schema. It is created in the schema "public2 and not in the
> schema 2forest", where it should be. Although db.connect -p verifys that
> all connection parameters are correctly set.
> I guess using v.extract without dissolving and doing that later using
> v.dissolve will solve the problem. I was just wondering if anyone
> experienced the same issues with the schemas and if there is a solution
> to this.
I guess this is a bug in v.db.addtable (which is just a script). It uses:
echo "CREATE TABLE $table ($COLUMN_DEF)" | db.execute
database="$database" driver="$driver"
to create the table, and so does not take into account the schema.
Should be easy to fix, but no time now. Please post a bug report about
this, so that it is not forgotten.
>
> Problem 2:
> This is really confusing me. I tried to use the capability of linking
> more than one attribute table to a map. Overall I succeded doing so.
> Grass reports (in german):
>
> ...................................................................................
> v.db.connect -o map=trees_geo_init key=cat_id layer=3
> table=forest.trees_buche
Just adding a database connection to a layer does not add any features
to that layer. In order for features to appear in a specific layer, you
have to give them a category value in that layer, i.e. with v.category.
Moritz
More information about the grass-user
mailing list