[GRASS-dev] [GRASS GIS] #75: v.db.join incorrectly uses v.db.connect and is broken for multi-layered vectors

GRASS GIS trac at osgeo.org
Fri Feb 29 11:36:46 EST 2008


#75: v.db.join incorrectly uses v.db.connect and is broken for multi-layered
vectors
---------------------+------------------------------------------------------
 Reporter:  tvrusso  |       Owner:  grass-dev at lists.osgeo.org
     Type:  defect   |      Status:  new                      
 Priority:  major    |   Milestone:  6.4.0                    
Component:  default  |     Version:  unspecified              
 Keywords:           |  
---------------------+------------------------------------------------------
 I attempted to use v.db.join to join a table to the second layer of a
 vector that had two layers (two tables connected to it).  v.db.join gave
 me error messages from db.describe reporting that "<sqlite> is not a valid
 parameter" and another reporting that the path to my sqlite database is
 not a valid parameter.  It turns out that
 what was really wrong was that the "driver" and "database" variables that
 are set in
 v.db.join:

 driver="`v.db.connect -g $GIS_OPT_MAP layer=$GIS_OPT_LAYER | cut -d' '
 -f5`"
 database="`v.db.connect -g $GIS_OPT_MAP layer=$GIS_OPT_LAYER | cut -d' '
 -f4`"

 on lines 76 and 77 are improperly set to "sqlite sqlite" and
 "/my/sqlite/db /my/sqlite/db" --- that is, two copies of each are stored
 in the variable.  That's because according to the man page, v.db.connect
 IGNORES the "layer=" option with the "-g" option and reports all database
 connections.  Since I have two layers, the commands above produce two
 copies of the data, and later, when $driver and $database are used in
 command lines they cause problems.

 Instead of using layer= to try to select the database and driver with
 v.db.connect, a more convoluted command line might be necessary, as for
 example:
 driver=`v.db.connect -g $GIS_OPT_MAP | head -n $GIS_OPT_LAYER | tail -1 |
 cut -d' ' -f5`"

 I tested out that kind of modification and it does appear to address the
 issue.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/75>
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/


More information about the grass-dev mailing list