[GRASS-user] Assign attributes of start and enpoints to, connecting lines

Richard Chirgwin rchirgwin at ozemail.com.au
Thu Dec 9 14:49:48 EST 2010


On 10/12/10 3:05 AM, grass-user-request at lists.osgeo.org wrote:
> Message: 5
> Date: Thu, 09 Dec 2010 18:05:50 +0200
> From: Micha Silver<micha at arava.co.il>
> Subject: Re: [GRASS-user] Assign attributes of start and enpoints to
> 	connecting	lines
> To: Hanlie Pretorius<hanlie.pretorius at gmail.com>
> Cc:grass-user at lists.osgeo.org
> Message-ID:<4D00FE5E.2000005 at arava.co.il>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 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 at 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



More information about the grass-user mailing list