[GRASSweb-list]markus: web/grass51/tutorial ex_basic.html,1.9,1.10

grass at intevation.de grass at intevation.de
Thu Nov 20 12:41:04 EST 2003


Author: markus

Update of /grassrepository/web/grass51/tutorial
In directory doto:/tmp/cvs-serv965

Modified Files:
	ex_basic.html 
Log Message:
added distance example

Index: ex_basic.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/ex_basic.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ex_basic.html	12 Sep 2003 08:05:09 -0000	1.9
+++ ex_basic.html	20 Nov 2003 17:41:02 -0000	1.10
@@ -415,6 +415,50 @@
 
 This may take some time depending on network speed and table size.
 
+<p><table width="100%" cellpadding="3" border="0">
+<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
+<a name="dist"></a>
+Distances from one climatic station to others (point to point distances)
+<DIV ALIGN=right><a href="#toc">[UP]</a></DIV>
+</b></big></font></td></tr></table>
+
+Assume you have a map of climatic stations and you want to know all
+distances from a certain station to all others. Easy to solve:
+
+<div class="code"><pre>
+#show all meteo stations:
+d.vect meteostations displ=shape,attr att=name
+#highlight station of interest:
+d.vect meteostations displ=shape,attr att=name where="name='Dos Gaggio'" col=yellow
+
+#extract station of interest (vector point) into a new map:
+v.extract meteostations out=stationdg  where="name='Dos Gaggio'"
+d.vect stationdg col=blue lcol=blue
+</pre></div>
+<P>
+Now we can calculate the distances from all stations to the selected
+station:
+
+<div class="code"><pre>
+#(take care for the 'max' parameter for maximum distance):
+v.distance -p from=meteostations to=stationdg col=dist up=dist
+
+#print with distances sorted:
+v.distance -p from=meteostations to=stationdg col=dist up=dist | sort -n -k 2 -t '|'
+[...]
+from_cat|dist
+82|1580.509095
+518|5560.323732
+54|7458.190196
+81|9026.606893
+83|9093.747797
+647|9820.778075
+57|10017.483616
+[...]
+</pre></div>
+
+With 'd.what.vect' or another 'db.select' query could can look up the names
+for the station IDs.
 
 <hr>
 <P>





More information about the grass-web mailing list