r.profile.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <h2>DESCRIPTION</h2>
  2. This program outputs two or four column (with <b>-g</b>) data to stdout or
  3. an ASCII file. The default two column output consists of cumulative profile
  4. length and raster value. The optional four column output consists
  5. of easting, northing, cumulative profile length, and raster value. Profile
  6. end or "turning" points can be set manually with the <b>coordinates</b>
  7. argument. The profile resolution, or distance between profile
  8. points, is obtained from the current region resolution, or can be manually
  9. set with the <b>resolution</b> argument.
  10. <p>
  11. The <b>coordinates</b> parameter can be set to comma separated geographic
  12. coordinates for profile line endpoints.
  13. Alternatively the coordinate pairs can be piped from the text file specified
  14. by <b>file</b> option, or if set to "-", from <tt>stdin</tt>.
  15. In these cases the coordinate pairs should be given one comma separated pair
  16. per line.
  17. <p>
  18. The <b>resolution</b> parameter sets the distance between each profile point
  19. (resolution). The resolution must be provided in GRASS database units (i.e.
  20. decimal degrees for Lat Long databases and meters for UTM). By default
  21. <em>r.profile</em> uses the resolution of the current GRASS region.
  22. <p>
  23. The <b>null</b> parameter can optionally be set to change the character
  24. string representing null values.
  25. <h2>OUTPUT FORMAT</h2>
  26. The multi column output from <em>r.profile</em> is intended for easy use in
  27. other programs. The output can be piped (|) directly into other programs or
  28. saved to a file for later use. Output with geographic coordinates (<em>-g</em>)
  29. is compatible with <em><a href="v.in.ascii.html">v.in.ascii</a></em> and can
  30. be piped direcly into this program.
  31. <div class="code"><pre>
  32. r.profile -g input=elevation coordinates=... | v.in.ascii output=elevation_profile separator=space
  33. </pre></div>
  34. The 2 column output is compatible with most plotting programs.
  35. <p>
  36. The optional RGB output provides the associated GRASS colour value for
  37. each profile point.
  38. <p>Option <b>units</b> enables to set units of the profile length output.
  39. If the units are not specified, current location units will be used.
  40. In case of geographic locations (latitude/longitude), meters are used as default unit.
  41. <h2>NOTES</h2>
  42. The profile resolution is measured exactly from the supplied end or
  43. "turning" point along the profile. The end of a profile segment will be an
  44. exact multiple of the profile resolution and will therefore not always match
  45. the end point coordinates entered for the segmanet.
  46. <p>To extract the numbers in scripts, following parameters can be used:
  47. <div class="code"><pre>
  48. r.profile input=dgm12.5 coordinates=3570631,5763556 2>/dev/null
  49. </pre></div>
  50. This filters out the everything except the numbers.
  51. <h2>EXAMPLES</h2>
  52. <h3>Extraction of values along profile defined by coordinates (variant 1)</h3>
  53. Extract a profile with coordinates (wayoints) provided on the command line
  54. (North Carolina data set):
  55. <div class="code"><pre>
  56. g.region raster=elevation -p
  57. r.profile -g input=elevation output=profile_points.csv \
  58. coordinates=641712,226095,641546,224138,641546,222048,641049,221186
  59. </pre></div>
  60. This will extract a profile along the track defined by the three coordinate
  61. pairs. The output file "profile_points.csv" contains
  62. east,north,distance,value (here: elevation).
  63. <p><br>
  64. <!-- d.where no longer there
  65. <b>Example 2</b><br>
  66. Extract a profile with coordinates provided from standard input or an external file:
  67. <p>First create a points file with <em><a href="d.where.html">d.where</a></em>
  68. <div class="code"><pre>
  69. d.where > saved.points
  70. </pre></div>
  71. Then pipe the points file into r.profile
  72. <div class="code"><pre>
  73. cat saved.points | r.profile input=elev.rast output=profile.pts file=-
  74. </pre></div>
  75. The advantage of this method is that the same profile points can be piped
  76. into different GRASS rasters by changing the input parameter.
  77. <p>
  78. With this method the coordinates must be given as space or tab separated
  79. easting and northing. Labels after these values are ignored.
  80. <p>
  81. Another example using d.where:
  82. <div class="code"><pre>
  83. d.where | r.profile elevation.dem
  84. </pre></div>
  85. <p><br>
  86. -->
  87. <h3>Extraction of values along profile defined by coordinates (variant 2)</h3>
  88. Coordinate pairs can also being "piped" into <em>r.profile</em> (variant 2a):
  89. <div class="code"><pre>
  90. r.profile elevation resolution=1000 file=- &lt;&lt; EOF
  91. 641712,226095
  92. 641546,224138
  93. 641546,222048
  94. 641049,221186
  95. EOF
  96. </pre></div>
  97. <p>
  98. Coordinate pairs can also being "piped" into <em>r.profile</em> (variant 2b):
  99. <div class="code"><pre>
  100. echo "641712,226095
  101. 641546,224138
  102. 641546,222048
  103. 641049,221186" > coors.txt
  104. cat coors.txt | r.profile elevation resolution=1000 file=-
  105. </pre></div>
  106. The output is printed into the terminal (unless the <em>output</em> parameter
  107. is used) and looks as follows:
  108. <div class="code"><pre>
  109. Using resolution: 1000 [meters]
  110. Output columns:
  111. Along track dist. [meters], Elevation
  112. Approx. transect length: 1964.027749 [meters]
  113. 0.000000 84.661507
  114. 1000.000000 98.179062
  115. Approx. transect length: 2090.000000 [meters]
  116. 1964.027749 83.638138
  117. 2964.027749 89.141029
  118. 3964.027749 78.497757
  119. Approx. transect length: 995.014070 [meters]
  120. 4054.027749 73.988029
  121. </pre></div>
  122. <h2>SEE ALSO</h2>
  123. <em>
  124. <a href="v.in.ascii.html">v.in.ascii</a>,
  125. <a href="r.what.html">r.what</a>,
  126. <a href="r.transect.html">r.transect</a>,
  127. <a href="wxGUI.html">wxGUI profile tool</a>
  128. </em>
  129. <h2>AUTHOR</h2>
  130. <a href="mailto:bcovill@tekmap.ns.ca">Bob Covill</a>
  131. <p>
  132. <i>Last changed: $Date$</i>