[GRASS-dev] Re: [GRASS GIS] #672: v.distance -a with upload=to_attr
and table= option: problems in table creation and value upload
GRASS GIS
trac at osgeo.org
Sun Oct 24 18:06:23 EDT 2010
#672: v.distance -a with upload=to_attr and table= option: problems in table
creation and value upload
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Vector | Version: unspecified
Keywords: v.distance | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by mlennert):
Replying to [ticket:672 mlennert]:
> When trying to create a distance matrix and upload that to a table, I've
stumbled upon what seems to be a very old bug in v.distance:
>
> 1) The table cannot be created because of a missing TO_ATTR: case in the
switch statement in vector/v.distance/main.c, line 790.
>
> 2) Even when such a TO_ATTR: case is added, the column in the new table
is filled with NULL values. I have not been able, yet, to figure out where
this problem comes from.
How to reproduce bug in NC demo data set:
{{{
g.copy vect=hospitals at PERMANENT,myhosp
v.distance from=myhosp to=myhosp upload=cat,dist,to_attr to_column=CANCER
column=to_cat,dist,to_cancer table=distance_cancer
}}}
The attached patch solves 1) & 2) for dbf and postgresql backends, but not
2) for SQLite. When using an SQLite backend, the trouble seems to come
from the fact that the same database and table are accessed twice. Maybe
some playing around with db_close_database_shutdown_driver might help, but
I haven't had the opportunity to play around with that. Anybody have any
hints about this ?
In any case I find the attached patch useful for the backends where it
works. It's against devel6, but should be straightforward to port to
trunk.
Moritz
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/672#comment:2>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list