r.horizon.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <h2>DESCRIPTION</h2>
  2. <b>r.horizon</b> computes the angular height of terrain horizon in
  3. radians. It reads a raster of elevation data and outputs the horizon
  4. outline in one of two modes:
  5. <ul>
  6. <li> single point: as a series of horizon
  7. heights in the specified directions from the given point. The results are
  8. written to the stdout.
  9. <li> raster: in this case the output is
  10. one or more raster maps, with each point in a raster giving the horizon
  11. height in a specific direction. One raster is created for each direction.
  12. </ul>
  13. <p>
  14. The directions are given as azimuthal angles (in degrees), with
  15. the angle starting with 0 towards East and moving counterclockwise
  16. (North is 90, etc.). The calculation takes into account the actual
  17. projection, so the angles are corrected for direction distortions
  18. imposed by it. The directions are thus aligned to those of the
  19. geographic projection and not the coordinate system given by the rows
  20. and columns of the raster map. This correction implies that the
  21. resulting cardinal directions represent true orientation towards the
  22. East, North, West and South. The only exception of this feature is
  23. LOCATION with x,y coordinate system, where this correction is
  24. not applied.
  25. <p>
  26. Using the <b>-c</b> flag, the azimuthal angles will be printed in compass
  27. orientation (North=0, clockwise).
  28. <h3>Input parameters:</h3>
  29. <p>The <i>elevation</i> parameter is an input elevation raster map. If
  30. the buffer options are used (see below), this raster should extend
  31. over the area that accommodate the presently defined region plus
  32. defined buffer zones.
  33. <p>The <i>step</i> parameter gives the angle step (in degrees)
  34. between successive azimuthal directions for the calculation of the
  35. horizon. Thus, a value of 5 for the <i>step</i> will give a total of
  36. 360/5=72 directions (72 raster maps if used in the raster map mode).
  37. <p>The <i>start</i> parameter gives the angle start (in degrees)
  38. for the calculation of the horizon. The default value is 0 (East with
  39. North being 90 etc.).
  40. <p>The <i>end</i> parameter gives the angle end (in degrees)
  41. for the calculation of the horizon. The end point is omitted!
  42. So for example if we run r.horizon with step=10, start=30 and end=70
  43. the raster maps generated by r.horizon will be only for angles:
  44. 30, 40, 50, 60. The default value is 360.
  45. <p>The <i>direction</i> parameter gives the initial direction of the
  46. first output. This parameter acts as an direction angle offset. For
  47. example, if you want to get horizon angles for directions 45 and 225
  48. degrees, the <i>direction</i> should be set to 45 and <i>step</i> to
  49. 180. If you only want one single direction, use this parameter to
  50. specify desired direction of horizon angle, and set the <i>step</i>
  51. size to 0 degrees. Otherwise all angles for a given starting <i>direction</i>
  52. with step of <i>step</i> are calculated.
  53. <p>The <i>distance</i> controls the sampling distance step size for the
  54. search for horizon along the line of sight. The default value is 1.0
  55. meaning that the step size will be taken from the raster resolution.
  56. Setting the value below 1.0 might slightly improve results for
  57. directions apart from the cardinal ones, but increasing the
  58. processing load of the search algorithm.
  59. <p>The <i>maxdistance</i> value gives a maximum distance to move away
  60. from the origin along the line of sight in order to search for the
  61. horizon height.
  62. <!-- check next statement in the source code -->
  63. The default <i>maxdistance</i> is the full map extent.
  64. The smaller this value the faster the calculation but
  65. the higher the risk that you may miss a terrain feature that can
  66. contribute significantly to the horizon outline. Note that a viewshed
  67. can be calculated with <em>r.viewshed</em>.
  68. <p>The <i>coordinate</i> parameter takes a pair of easting-northing values
  69. in the current coordinate system and calculates the values of angular
  70. height of the horizon around this point. To achieve the
  71. consistency of the results, the point coordinate is
  72. aligned to the midpoint of the closest elevation raster cell.
  73. <p>If an analyzed point (or raster cell) lies close to the edge of
  74. the defined region, the horizon calculation may not be realistic,
  75. since it may not see some significant terrain features which could
  76. have contributed to the horizon, because these features are outside
  77. the region. There are to options how to set the size of the buffer
  78. that is used to increase the area of the horizon analysis. The
  79. <i>bufferzone</i> parameter allows you to specify the same size of
  80. buffer for all cardinal directions and the parameters <i>e_buff</i>,
  81. <i>n_buff</i>, <i>s_buff</i>, and <i>w_buff</i> allow you to specify
  82. a buffer size individually for each of the four directions. The
  83. buffer parameters influence only size of the read elevation map,
  84. while the analysis in the raster mode will be done only for the
  85. area specified by the current region definition.
  86. <p>The <i>basename</i> parameter gives the basename of the output
  87. horizon raster maps. The raster name of each horizon direction
  88. raster will be constructed as <i>basename_</i>ANGLE, where ANGLE
  89. is the angle in degrees with the direction. If you use <b>r.horizon</b>
  90. in the single point mode this option will be ignored.
  91. <p>The <i>output</i> parameter allows saving the resulting horizon
  92. angles in a comma separated ASCII file (single point mode only). If
  93. you use <b>r.horizon</b> in the raster map mode this option will be ignored.
  94. <p>At the moment the elevation and maximum distance must be measured in meters,
  95. even if you use geographical coordinates (longitude/latitude). If your
  96. projection is based on distance (easting and northing), these too must
  97. be in meters. The buffer parameters must be in the same units as the
  98. raster coordinates (e.g., for latitude-longitude locations buffers are
  99. measured in degree unit).
  100. <h2>METHOD</h2>
  101. <p>The calculation method is based on the method used in <b>r.sun</b>
  102. to calculate shadows. It starts at a very shallow angle and walks
  103. along the line of sight and asks at each step whether the line of
  104. sight &quot;hits&quot; the terrain. If so, the angle is increased to
  105. allow the line of sight to pass just above the terrain at that point.
  106. This is continued until the line of sight reaches a height that is
  107. higher than any point in the region or until it reaches the border of
  108. the region (see also the <i>bufferzone,e_buff</i>, <i>n_buff</i>,
  109. <i>s_buff</i>, and <i>w_buff</i>). The the number of lines of sight (azimuth
  110. directions) is determined from the <i>direction</i> and
  111. <i>step</i> parameters. The method takes into account the curvature
  112. of the Earth whereby remote features will seem to be lower than they
  113. actually are. It also accounts for the changes of angles towards
  114. cardinal directions caused by the projection (see above).
  115. <h2>EXAMPLES</h2>
  116. The examples are intended for the North Carolina sample dataset.
  117. <h3>Single point mode</h3>
  118. <b>Example 1</b>: determine horizon angle in 225 degree direction (output
  119. of horizon angles CCW from East):
  120. <div class="code"><pre>
  121. g.region raster=elevation -p
  122. r.horizon elevation=elevation direction=215 step=0 bufferzone=200 \
  123. coordinates=638871.6,223384.4 maxdistance=5000
  124. </pre></div>
  125. <p>
  126. <b>Example 2</b>: determine horizon values starting at 90 deg (North),
  127. step size of 5 deg, saving result as CSV file:
  128. <div class="code"><pre>
  129. r.horizon elevation=elevation direction=90 step=5 bufferzone=200 \
  130. coordinates=638871.6,223384.4 maxdistance=5000 file=horizon.csv
  131. </pre></div>
  132. <p>
  133. <b>Example 3</b>: test point near highway intersection, saving result
  134. as CSV file for plotting the horizon around the highway intersection:
  135. <div class="code"><pre>
  136. g.region n=223540 s=220820 w=634650 e=638780 res=10 -p
  137. r.horizon elevation=elevation direction=0 step=5 bufferzone=200 \
  138. coordinates=636483.54,222176.25 maxdistance=5000 -d file=horizon.csv
  139. </pre></div>
  140. <center>
  141. <img src="rhorizon_shaded_dem_point.png"><br>
  142. Test point near high way intersection (North Carolina sample dataset)
  143. <p>
  144. <img src="rhorizon_singlepoint_plot.png"><br>
  145. Horizon angles for test point (CCW from East)
  146. </center>
  147. <p>We can plot horizon in polar coordinates using Matplotlib in Python:
  148. <div class="code"><pre>
  149. import numpy as np
  150. import matplotlib.pyplot as plt
  151. horizon = np.genfromtxt('horizon.csv', delimiter=',')
  152. horizon = horizon[1:, :]
  153. ax = plt.subplot(111, polar=True)
  154. bars = ax.plot(horizon[:, 0] / 180 * np.pi,
  155. (90 - horizon[:, 1]) / 180 * np.pi)
  156. # uncomment the 2 following lines when using -c flag
  157. # ax.set_theta_direction(-1)
  158. # ax.set_theta_zero_location('N')
  159. plt.show()
  160. </pre></div>
  161. <center>
  162. <img src="rhorizon_polar_plot.png"><br>
  163. Horizon plot in polar coordinates.
  164. </center>
  165. <h3>Raster map mode</h3>
  166. Raster map mode (output maps "horangle*" become input for <em>r.sun</em>):
  167. <div class="code"><pre>
  168. # we put a bufferzone of 10% of maxdistance around the study area
  169. # compute only direction between 90 and 270 degrees
  170. r.horizon elevation=elevation step=30 start=90 end=300 \
  171. bufferzone=200 output=horangle maxdistance=5000
  172. </pre></div>
  173. <h2>REFERENCES</h2>
  174. <p>Hofierka J., 1997. Direct solar radiation modelling within an
  175. open GIS environment. Proceedings of JEC-GI'97 conference in Vienna,
  176. Austria, IOS Press Amsterdam, 575-584
  177. <p>Hofierka J., Huld T., Cebecauer T., Suri M., 2007. Open Source Solar
  178. Radiation Tools for Environmental and Renewable Energy Applications,
  179. <a href="http://www.isess.org/papers.asp?year=2007">International Symposium on
  180. Environmental Software Systems</a>, Prague, 2007
  181. <p>Neteler M., Mitasova H., 2004. Open Source GIS: A GRASS GIS
  182. Approach, <a href="http://www.springer.com/geography/gis+cartography/book/978-0-387-35767-6">Springer</a>, New York.
  183. ISBN: 1-4020-8064-6, 2nd Edition 2004 (reprinted 2005), 424 pages
  184. <p>Project <a href="http://re.jrc.ec.europa.eu/pvgis/">PVGIS</a>, European
  185. Commission, DG Joint Research Centre 2001-2007
  186. <p>Suri M., Hofierka J., 2004.
  187. A New GIS-based Solar Radiation Model and Its Application for
  188. Photovoltaic Assessments. <a href="http://www.blackwellpublishing.com/toc.asp?ref=1361-1682">Transactions
  189. in GIS</a>, 8(2), 175-190
  190. <h2>SEE ALSO</h2>
  191. <em>
  192. <a href="r.sun.html">r.sun</a>,
  193. <a href="r.sunmask.html">r.sunmask</a>,
  194. <a href="r.viewshed.html">r.viewshed</a>
  195. </em>
  196. <h2>AUTHORS</h2>
  197. <p>Thomas Huld, Joint Research Centre of
  198. the European Commission, Ispra, Italy
  199. <br>
  200. <p>Tomas Cebecauer, Joint Research Centre
  201. of the European Commission, Ispra, Italy
  202. <br>
  203. <p>Jaroslav Hofierka, GeoModel s.r.o.,
  204. Bratislava, Slovakia <br>Marcel Suri, Joint Research Centre of the
  205. European Commission, Ispra, Italy
  206. <p>&copy; 2007, Thomas Huld, Tomas Cebecauer, Jaroslav Hofierka, Marcel Suri
  207. <ADDRESS STYLE="margin-bottom: 0.2in"><a href="mailto:Thomas.Huld@jrc.it">Thomas.Huld@jrc.it</a>
  208. <a href="mailto:Tomas.Cebecauer@jrc.it">Tomas.Cebecauer@jrc.it</a>
  209. <a href="mailto:hofi@geomodel.sk">hofierka@geomodel.sk</a>
  210. <a href="mailto:Marcel.Suri@jrc.it">Marcel.Suri@jrc.it</a>
  211. </ADDRESS>
  212. <p><i>Last changed: $Date$</i>