[GRASS-user] calculate distances on road map between points

dziadgba dziadgba dziadgba at googlemail.com
Mon Oct 22 13:09:25 EDT 2007


hy,
I would like to calculated the distances between points.

I am doing it with the following script which reads coordinates of the
points form two files (produced with v.report), uses v.net.path to create
the shortest path and then v.patch to produce a table with all distances of
al nodes.

---------------------------------------------------------------------------------------------------------

cat coordTempFile1 | while read line1; do
...
xcoor1=${line1 ...

ycoor1=${line1 ....

cat coordTempFile2 | while read line2; do

xcoor2=${line2 ...
ycoor2=${line2 ...

echo "$inputRoadLayer $xcoor1 $ycoor1 $xcoor2 $ycoor2" | v.net.path $input
out=newpathTemp --o dmax=12000
g.copy vect=newpathTemp,newpath

echo "UPDATE newpath SET fcat = $nodeName1"| db.execute
echo "UPDATE newpath SET tcat = $nodeName2"| db.execute

if [ $firsttime -eq 1 ];
then g.copy vect=newpath,"$output"
g.remove vect=newpath
echo "I have created a new path";
else
v.patch -a -e input=newpath out="$output" --o;
g.remove vect=newpath
echo "I have added path to collection";

fi
done
firsttime=0
done
-------------------------------------------------------------------------------------------------------------

the I would use v. report to get a text file with all distances.
It works fine for a small number of nodes, for a larger number it stops
after about 8000 calculations.
But anyway, maybe somebody can give me a hint of how to do that in a smarter
way?

many thanks
dziadgba
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20071022/827fb3a8/attachment.html


More information about the grass-user mailing list