[GRASS-user] v.distance -a : how join output table to output lines?

Moritz Lennert mlennert at club.worldonline.be
Tue Oct 8 05:13:18 PDT 2013


On 08/10/13 13:52, Enrico Gallo wrote:
> Dear Micha, dear list,
>
>
> 2013/10/3 Micha Silver<micha at arava.co.il>
>>
>> On 03/10/2013 12:42, Enrico Gallo wrote:
>>
>> Dear list,
>>
>> when using (GRASS 6.4.3)  v.distance -a ,  points to lines, you get:
>> 1. [output] vector theme, with no attribute table, with N elements
>> 2. [table] , with N rows, optionally with source and target cat
>>
>> Any idea about joining the two outputs without spatial join?
>>
>> You probably want to look at the "upload=..." parameter
>
>
> the problem is a bit more complex than using the "upload" parameter, IMHO
>
> when using v.distance looking for all possible connections (not only
> the nearest one)
>
> v.distance -a from=vector_from to=vector_to output=connector
> upload=cat,dist column=cat_to,distance table=connector_attributes
>
> we get
>
> - a vector output with connecting lines
> - an output table with from_cat [by default], cat_to&  distance
> fields, completely populated
>
> the output table seems to me a perfect attribute table for vector
> output, but no common field is given to join the two:
>
> Adding a table (v.db.addtable) and updating the cat field (v.to.db,
> cat) of vector output doesn't solve, as I am not able to add an
> autoincrement field in output table to perfom a join, without direct
> SQL tricks.
>
> Connecting the given output table (v.db.addtable) and then updating a
> cat field, doesn't help even, because v.to.db uses an "INSERT"
> statement with cat option , not the usual "UPDATE", so you have N
> records with no cat + N records with cat but without attributes.
>
> In both cases we are assuming the two "outputs" have the same order
> for elements , but I don't know how much robust is this assumption!
>
> But without a robust join, any spatial analysis of connecting lines is
> almost impossible...
>
> I am missing something trivial to bypass this impasse?

No, what you are trying to do seems quite obvious, but is not 
implemented in v.distance AFAIK. I think you should file an enhancement 
request. I agree that being able to link the table resulting from -a to 
the vector map would be a nice addition.

Moritz


More information about the grass-user mailing list