[GRASS-user] Load attributes of point theme into adjoining line theme - possible?

Jarek Jasiewicz jarekj at amu.edu.pl
Wed Feb 7 11:28:42 EST 2007


Wolfgang Qual napisał(a):
> Hello Jarek,
> in some cases of my dataset, there is sometimes more than one point related to one line-segment. In that case, only the information of the nearest point should be transferred to the corresponding line segment. Possible?
>
> Best regards,
> Wolfgang
>
>
>   
>> Hamish napisał(a):
>>     
>>> Wolfgang Qual wrote:
>>>   
>>>       
>>>> Hi list,
>>>> another question with a small picture: my dataset consists of two
>>>> themes, a point theme, representing locations where the traffic
>>>> density of an adjoining segment of a street was measuredd and the
>>>> corresponing line theme - the street. Now, I would like to add the
>>>> traffic information to the line theme (in the picture below, three
>>>> measurement stations are drawn). 
>>>>
>>>>
>>>>         x(45)
>>>>     ----------------�\
>>>>                       \       x(100)
>>>>                        \--------------------------
>>>>                        /
>>>>                       /
>>>>         -------------�
>>>>             x(55)
>>>>
>>>> Is it possible to perform such an operation within GRASS? Any ideas
>>>> are welcome! 
>>>>     
>>>>         
>>> v.distance
>>> ?
>>>
>>>
>>> Hamish
>>>
>>> _______________________________________________
>>> grassuser mailing list
>>> grassuser at grass.itc.it
>>> http://grass.itc.it/mailman/listinfo/grassuser
>>>   
>>>       
>> well, question seems to be unclear...
>>
>> it depends on how many traffic points are on the one line segment If one 
>> to one the situation is very simple. Use v.distance with to_attr 
>> parameter (from line to point!), if there are more mesurment points it 
>> could be the problem. relation between points and line shall to be 
>> crated (v.distance from points to line with cat attrribute), and the 
>> rest of work in database. If there are more than one point to segment 
>> please let me know I will try to describe how to make it in detail.
>>     
>
>   
You need only nearest point or rather need sum or avaradge of all 
related points??
if the second do the folowing:

- use postgreSQL (SQLite is not enough AFAIK)
- next use v.distance from point feature to line feature to found 
nearest line to every point with updating new column 'lcat' of point 
table with cat of line, you will have relation on cat
- next use pgSQL clause CREATE TABLE AS ... (see help for more details) 
to create new joined table with something like this:

CREATE TABLE new AS
SELECT *.line, traffic.point, FROM line INNER JOIN point ON 
line.cat=point.lcat

You will recive
table with non-uniqe cat.line. Next cat must to be uniqe

CREATE TABLE new1 AS
SELECT cat, sum(traffic), any_thing_you_need FROM new GROUP BY cat

Connect the line feature to the new1 table


I made very similar work few days ago. It works.
Jarek




More information about the grass-user mailing list