r.distance.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <h2>DESCRIPTION</h2>
  2. <em>r.distance</em> locates the closest points between "objects" in two raster maps. An
  3. "object" is defined as all the grid cells that have the same category
  4. number, and closest means having the shortest "straight-line" distance.
  5. The cell centers are considered for the distance calculation (two
  6. adjacent grid cells have the distance between their cell centers).
  7. <p>
  8. The output is an ascii list, one line per pair of objects, in the following form:
  9. <div class="code"><pre>
  10. cat1:cat2:distance:east1:north1:east2:north2
  11. </pre></div>
  12. <dl>
  13. <dt><b>cat1</b>
  14. <dd>Category number from map1
  15. <dt><b>cat2</b>
  16. <dd>Category number from map2
  17. <dt><b>distance</b>
  18. <dd>The distance in meters between "cat1" and "cat2"
  19. <dt><b>east1,north1</b>
  20. <dd>The coordinates of the grid cell "cat1" which is closest to "cat2"
  21. <dt><b>east2,north2</b>
  22. <dd>The coordinates of the grid cell "cat2" which is closest to "cat1"
  23. </dl>
  24. <h3>Flags</h3>
  25. <b>-l</b>
  26. The -l flag outputs the category labels of the matched raster objects at the
  27. beginning of the line, if they exist.
  28. <p>
  29. <b>-o</b>
  30. The -o flag reports zero distance if the input rasters are overlapping.
  31. <p>
  32. <h2>NOTES</h2>
  33. The output format lends itself to filtering. For example, to "see" lines
  34. connecting each of the category pairs in two maps, filter the output using
  35. awk and then into <em>d.graph</em>:
  36. <p>
  37. <div class="code"><pre>
  38. r.distance map=map1,map2 | \
  39. awk -F: '{print "move",$4,$5,"\ndraw",$6,$7}' | d.graph -m
  40. </pre></div>
  41. <p>
  42. To create a vector map of all the "map1" coordinates, filter the output into
  43. awk and then into <em>v.in.ascii</em>:
  44. <p>
  45. <div class="code"><pre>
  46. r.distance map=map1,map2 | \
  47. awk -F: '{print $4,$5}' | v.in.ascii format=point output=name separator=space
  48. </pre></div>
  49. <h2>SEE ALSO</h2>
  50. <em>
  51. <a href="r.buffer.html">r.buffer</a>,
  52. <a href="r.cost.html">r.cost</a>,
  53. <a href="r.drain.html">r.drain</a>,
  54. <a href="r.grow.html">r.grow</a>,
  55. <a href="r.grow.distance.html">r.grow.distance</a>,
  56. <a href="v.distance.html">v.distance</a>
  57. </em>
  58. <h2>AUTHOR</h2>
  59. Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
  60. <p>
  61. <i>Last changed: $Date$</i>