On 10/12/10 3:05 AM, grass-user-request@lists.osgeo.org wrote:
Message: 5
Date: Thu, 09 Dec 2010 18:05:50 +0200
From: Micha Silver<micha@arava.co.il>
Subject: Re: [GRASS-user] Assign attributes of start and enpoints to
connecting lines
To: Hanlie Pretorius<hanlie.pretorius@gmail.com>
Cc:grass-user@lists.osgeo.org
Message-ID:<4D00FE5E.2000005@arava.co.il>
Content-Type: text/plain; charset=ISO-8859-1; format=flowedOn 09/12/2010 16:38, Hanlie Pretorius wrote:
> Hi,
>
> I'm working in GRASS 6.4.0 on Windows XP.
>
> I'm creating a hydrological model and am using GIS to prepare the data.
>
> I've split my river layer into about 100 segments and I've digitised
> the start and end point of each river segment on a points layer.
>
> For the points layer, I calculate a 'name' from a prefix and a sequental number.
>
> What I would like to do, is to assign for each river segment the name
> of the start node and the name of the end node to the attribute table
> of the river segment layer.
>
> Can anyone give me pointers on how to do this?I think that v.distance can do this. begin by adding two
attrib columns to your river layer, one for the start node
label, and one for the end node label. Then run v.distance
twice to get the labels from the 'name' column from each of
the node layers. Finally concatenate the two labels together.
So...
# Add columns
v.db.addcol rivers col="start_node varchar(8), end_node
varchar(8), label varchar(16)"
# Use whatever size strings you need
v.distance from=rivers to=end_nodes from_type=line
to_type=point upload=to_attrib column=name to_col=end_node
# and again for the start_nodes
#Now merge the columns
echo "UPDATE rivers SET label=(start_node + end_node)" |
db.execute
# I'm not sure the above '+' will work on all database
connections. With dbf probably not...> Thanks
> Hanlie
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> This mail was received via Mail-SeCure System.
>-- Micha Silver http://www.surfaces.co.il/ Arava Development Co. +972-52-3665918
Hanlie, Micha,
A small point, but important if you ever need to transfer labels with large data sets. In v.distance, use the dmax=0 parameter to speed up processing time.
Richard