wow.&nbsp; i'll have to sort through this.&nbsp; i have been working on network analysis too.&nbsp; i'll be glad to help where i can, but i'll have to digest all the info first.<br><br>one of the big problems i ran into was running v.clean
 with a tolerance.&nbsp; apparently that would not split at the lines after doing a v.distance to the streets.&nbsp; so i had to go to each street connection and verify that there was in fact a node for the connectors (v.distance) out put to the streets.&nbsp; in many instances there were not, so i had to split the street line there and 
v.clean again.&nbsp; I talked with Markus about this, and the only difference was that he had run his without specifying a threshold for v.clean while using the tool=break,snap.&nbsp; it looks like you did the same thing.<br><br>i would spot check some connections and make sure that nodes exist and that the connectors are infact connected via nodes for proper topology.
<br><br><div><span class="gmail_quote">On 8/2/06, <b class="gmail_sendername"><a href="mailto:andrew.haywood@poyry.com">andrew.haywood@poyry.com</a></b> &lt;<a href="mailto:andrew.haywood@poyry.com">andrew.haywood@poyry.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<br><font face="sans-serif" size="2">Dear all,</font><br><br><font face="sans-serif" size="2">I am a new person to grass and am having
some problems with running a simple network analysis. If anybody can help
me it would be greatly appreciated. &nbsp;I am running grass 6.0 on debian.</font><br><font face="sans-serif" size="2">I have imported a shapefile representing
5km grid polygons across a large area. I have also imported a road shapefile
within this grid. And have imported a point shapefile with town locations
close to this road (network).</font><br><br><font face="sans-serif" size="2">What I would like to do for each centroid
of my 5km grid polygon layer is to calculate the nearest straight line
distance to the road feature. Once having calculated this distance - calculate
the distance along the road network to each town. Below is my attempt at
doing this. Any help/suggestions on improvement would be greatly appreciated.</font><br><br><font face="sans-serif" size="2">I am having problems making sure that
my town locations are on my road network and that the road network is complete.
I think that the road network is made up of line segments that are not
quite connected so I have tried v.clean to &quot;buffer the roads toegther&quot;.
Any suggestions on how to ensure that the lines are connected would be
greatly appreciated. The following are a list of commands that I am currently
using. My problem is that my network is not connected.</font><br><br><font face="Courier New" size="2">#v.in.ogr dsn=/home/andrew/rast.shp
output=rast min_area=0.0001 snap=-1</font><br><font face="Courier New" size="2">#v.in.ogr dsn=/home/andrew/road_seg.shp
output=road_seg min_area=0.0001 snap=-1 &nbsp;</font><br><font face="Courier New" size="2">#v.in.ogr dsn=/home/andrew/towns.shp
output=towns min_area=0.0001 snap=-1 </font><br><br><font face="sans-serif" size="2">I then try and convert the road segments
into connected lines </font><br><font face="Courier New" size="2">v.build.polylines input=road_seg output=road
</font><br><br><font face="sans-serif" size="2">I then try and intersect the towns and
the roads together </font><br><font face="Courier New" size="2">v.patch in=road,towns out=road_towns</font><br><br><font face="sans-serif" size="2">I then connect the towns and the roads</font><br><font face="Courier New" size="2">
v.distance -p from=towns to=road output=road_towns_connect
upload=dist column=dist</font><br><br><font face="Courier New" size="2">#patch connecting line with roads and
towns</font><br><font face="Courier New" size="2">v.patch in=road_towns_connect,road_towns
out=pre_network_road_towns</font><br><font face="Courier New" size="2">v.db.connect road_towns dr=dbf data='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
table=road layer=1 key=cat</font><br><font face="Courier New" size="2">v.db.connect road_towns dr=dbf data='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
table=towns layer=2 key=cat</font><br><font face="Courier New" size="2">v.clean in=pre_network_road_towns out=network_road_towns
tool=break,snap</font><br><br><font face="Courier New" size="2">#add columns to rast polygon</font><br><font face="Courier New" size="2">echo &quot;ALTER TABLE rast ADD COLUMN
from_cat integer&quot; | db.execute</font><br><font face="Courier New" size="2">echo &quot;ALTER TABLE rast ADD COLUMN
dist double&quot; | db.execute</font><br><font face="Courier New" size="2">echo &quot;ALTER TABLE rast ADD COLUMN
to_x double&quot; | db.execute</font><br><font face="Courier New" size="2">echo &quot;ALTER TABLE rast ADD COLUMN
to_y double&quot; | db.execute</font><br><br><font face="Courier New" size="2">#need to run distance command</font><br><font face="Courier New" size="2">v.distance from=rast to=network_road_towns
from_type=centroid to_type=line from_layer=1 to_layer=1 dmax=-1 upload=cat,dist,to_x,to_y
column=from_cat,dist,to_x,to_y </font><br><br><font face="Courier New" size="2">#spit out to_x to_y coordinates of
intersection with network_towns_points</font><br><font face="Courier New" size="2">v.db.select map=rast layer=1 fs=&quot;|&quot;
-c &gt; xy_info_on_network</font><br><font face="Courier New" size="2">#spit x and y corrdinates of intersection
to a flatfile</font><br><font face="Courier New" size="2">awk &lt; xy_info_on_network -F&quot;|&quot;
'{ print $9,$10}' &gt; xy_on_network</font><br><font face="Courier New" size="2">#remove duplicates in file (I think
there are ??? points in the intersection)</font><br><font face="Courier New" size="2">sort xy_on_network &gt; xy_on_network_sort</font><br><font face="Courier New" size="2">uniq xy_on_network_sort &gt; xy_on_network_uniq
</font><br><font face="Courier New" size="2">v.out.ascii input=towns output=xy_towns
format=point </font><br><br><br><br><font face="sans-serif" size="2">I then sucked the points of intersection
with the road network (xy_on_network_uniw) and the town locations &nbsp;(xy_towns)
into a perl script and spat out a big file that looked like this to loop
through each raster centroid intersection with the network and the location
of the town.</font><br><br><font face="sans-serif" size="2">echo &quot;1 574705.304072 9192756.736556
574705.30421218 9192756.73643771 &quot; | v.net.path network_road_points
&nbsp;out=mypath nlayer=1</font><br><font face="sans-serif" size="2">v.db.select map=mypath layer=1 fs='|'
&gt;&gt;fun</font><br><font face="sans-serif" size="2">g.remove vect=mypath</font><br><font face="sans-serif" size="2">echo &quot;2 574705.304212 9192756.736438
574705.30421218 9192756.73643771 &quot; | v.net.path network_road_points
&nbsp;out=mypath nlayer=1</font><br><font face="sans-serif" size="2">v.db.select map=mypath layer=1 fs='|'
&gt;&gt;fun</font><br><font face="sans-serif" size="2">g.remove vect=mypath</font><br><font face="sans-serif" size="2">...</font><br><font face="sans-serif" size="2">...</font><br><font face="sans-serif" size="2">...</font>
<br><br><font face="sans-serif" size="2">when I run this i get errors (on some
but not all v.net.path calls) basically saying that the node cannot be
found and reports a very big distance as a default. I have started to look
at the network and i think it is because I havent closed it properly. Any
help with regard to this. Also im thinking that it may be the accuracy
of the xy locations in ascii dumps. Im not sure if I could use node id's
and that would be better. Again any suggestions would be appreciated.</font><br><br><font face="sans-serif" size="2">cheers</font><br><br><font face="sans-serif" size="2">Andy</font><br><br><br><br>
This email and any files transmitted with it are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use, distribution, or reproduction of the contents of this email is strictly prohibited and may be unlawful. If you are not the intended recipient, please notify the sender by return email and destroy all copies of the original message including any attachments thereto. 
<br>
Thank you.<br>
</div><br>_______________________________________________<br>grassuser mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:grassuser@grass.itc.it">grassuser@grass.itc.it</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://grass.itc.it/mailman/listinfo/grassuser" target="_blank">
http://grass.itc.it/mailman/listinfo/grassuser</a><br><br><br></blockquote></div><br>