r.proj.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <h2>DESCRIPTION</h2>
  2. <em>r.proj</em> projects a raster map in a specified mapset of a
  3. specified location from the projection of the input location to a raster map
  4. in the current location. The projection information is taken from the
  5. current PROJ_INFO files, as set and viewed with
  6. <em><a href="g.proj.html">g.proj</a></em>.
  7. <h3>Introduction</h3>
  8. <h4>Map projections</h4>
  9. Map projections are a method of representing information from a curved
  10. surface (usually a spheroid) in two dimensions, typically to allow
  11. indexing through cartesian coordinates. There are a wide variety of
  12. projections, with common ones divided into a number of classes,
  13. including cylindrical and pseudo-cylindrical, conic and pseudo-conic,
  14. and azimuthal methods, each of which may be conformal, equal-area, or
  15. neither.
  16. <p>The particular projection chosen depends on the purpose of the
  17. project, and the size, shape and location of the area of interest.
  18. For example, normal cylindrical projections are good for maps which
  19. are of greater extent east-west than north-south and in equatorial
  20. regions, while conic projections are better in mid-latitudes;
  21. transverse cylindrical projections are used for maps which are of
  22. greater extent north-south than east-west; azimuthal projections are
  23. used for polar regions. Oblique versions of any of these may also be
  24. used. Conformal projections preserve angular relationships, and
  25. better preserve arc-length, while equal-area projections are more
  26. appropriate for statistical studies and work in which the amount of
  27. material is important.
  28. <p>Projections are defined by precise mathematical relations, so the
  29. method of projecting coordinates from a geographic reference frame
  30. (latitude-longitude) into a projected cartesian reference frame (eg
  31. metres) is governed by these equations. Inverse projections can also
  32. be achieved. The public-domain Unix software package <i>PROJ.4</i>
  33. [1] has been designed to perform these transformations, and the user's
  34. manual contains a detailed description of over 100 useful projections.
  35. This also includes a programmers library of the projection methods to
  36. support other software development.
  37. <p>Thus, converting a vector map - in which objects are located with
  38. arbitrary spatial precision - from one projection into another is
  39. usually accomplished by a simple two-step process: first the location
  40. of all the points in the map are converted from the source through an
  41. inverse projection into latitude-longitude, and then through a forward
  42. projection into the target. (Of course the procedure will be one-step
  43. if either the source or target is in geographic coordinates.)
  44. <p>Converting a raster map, or image, between different projections,
  45. however, involves additional considerations. A raster may be
  46. considered to represent a sampling of a process at a regular, ordered
  47. set of locations. The set of locations that lie at the intersections
  48. of a cartesian grid in one projection will not, in general, coincide
  49. with the sample points in another projection. Thus, the conversion of
  50. raster maps involves an interpolation step in which the values of
  51. points at intermediate locations relative to the source grid are
  52. estimated.
  53. <h4>Projecting vector maps within the GRASS GIS</h4>
  54. <!-- move this into v.proj.html !! -->
  55. GIS data capture, import and transfer often requires a projection
  56. step, since the source or client will frequently be in a different
  57. projection to the working projection.
  58. <p>In some cases it is convenient to do the conversion outside the
  59. package, prior to import or after export, using software such
  60. as <i>PROJ.4</i>'s
  61. <em><a href="http://proj.maptools.org/">cs2cs</a></em> [1]. This is an easy
  62. method for converting an ASCII file containing a list of coordinate points,
  63. since there is no topology to be preserved and <i>cs2cs</i> can be used to
  64. process simple lists using a one-line command. The <em>m.proj</em> module
  65. provides a handy front end to <tt>cs2cs</tt>.
  66. <p>Vector maps is generally more complex, as parts of the data stored in
  67. the files will describe topology, and not just coordinates. In GRASS
  68. GIS the
  69. <em><a href="v.proj.html">v.proj</a></em> module is provided to reproject
  70. vector maps, transferring topology and attributes as well as node coordinates.
  71. This program uses the projection definition and parameters which are stored in
  72. the PROJ_INFO and PROJ_UNITS files in the PERMANENT mapset directory for every
  73. GRASS location.
  74. <h3>Design of r.proj</h3>
  75. As discussed briefly above, the fundamental step in re-projecting a
  76. raster is resampling the source grid at locations corresponding to the
  77. intersections of a grid in the target projection. The basic procedure
  78. for accomplishing this, therefore, is as follows:
  79. <p><em>r.proj</em> converts a map to a new geographic projection. It
  80. reads a map from a different location, projects it and write it out to
  81. the current location. The projected data is resampled with one of four
  82. different methods: nearest neighbor, bilinear, bicubic iterpolation or
  83. lanczos.
  84. <p>The <b>method=nearest</b> method, which performs a nearest neighbor
  85. assignment, is the fastest of the three resampling methods. It is
  86. primarily used for categorical data such as a land use classification,
  87. since it will not change the values of the data
  88. cells. The <b>method=bilinear</b> method determines the new value of
  89. the cell based on a weighted distance average of the 4 surrounding
  90. cells in the input map. The <b>method=bicubic</b> method determines the
  91. new value of the cell based on a weighted distance average of the 16
  92. surrounding cells in the input map. The <b>method=lanzcos</b> method
  93. determines the new value of the cell based on a weighted distance
  94. average of the 25 surrounding cells in the input map. Compared to
  95. bicubic, lanczos puts a higher weight on cells close to the center and a
  96. lower weight on cells away from the center, resulting in slightly
  97. better contrast.
  98. <p>The bilinear, bicubic and lanczos interpolation methods are most
  99. appropriate for continuous data and cause some smoothing. The amount
  100. of smoothing decreases from bilinear to bicubic to lanczos. These
  101. options should not be used with categorical data, since the cell
  102. values will be altered.
  103. <p>In the bilinear, bicubic and lanczos methods, if any of the surrounding
  104. cells used to interpolate the new cell value are null, the resulting
  105. cell will be null, even if the nearest cell is not null. This will
  106. cause some thinning along null borders, such as the coasts of land
  107. areas in a DEM. The bilinear_f, bicubic_f and lanczos_f interpolation
  108. methods can be used if thinning along null edges is not desired.
  109. These methods &quot;fall back&quot; to simpler interpolation methods
  110. along null borders. That is, from lanczos to bicubic to bilinear to
  111. nearest.
  112. <p>If nearest neighbor assignment is used, the output map has the same
  113. raster format as the input map. If any of the interpolations is used,
  114. the output map is written as floating point.
  115. <p>Note that, following normal GRASS conventions, the coverage and
  116. resolution of the resulting grid is set by the current region
  117. settings, which may be adjusted
  118. using <em><a href="g.region.html">g.region</a></em>. The target raster
  119. will be relatively unbiased for all cases if its grid has a similar
  120. resolution to the source, so that the resampling/interpolation step is
  121. only a local operation. If the resolution is changed significantly,
  122. then the behaviour of the generalisation or refinement will depend on
  123. the model of the process being represented. This will be very
  124. different for categorical versus numerical data. Note that three
  125. methods for the local interpolation step are provided.
  126. <p><em>r.proj</em> supports general datum transformations, making use of
  127. the <em>PROJ.4</em> co-ordinate system translation library.
  128. <h2>NOTES</h2>
  129. If <b>output</b> is not specified it is set to be the same as input map
  130. name.
  131. <br>
  132. If <b>mapset</b> is not specified, its name is assumed to be the same
  133. as the current mapset's name.
  134. <br>
  135. If <b>dbase</b> is not specified it is assumed to be the current
  136. database. The user only has to specify <b>dbase</b> if the source
  137. location is stored in another separate GRASS database.
  138. <p>
  139. To avoid excessive time consumption when reprojecting a map the region
  140. and resolution of the target location should be set appropriately
  141. beforehand.
  142. <p>A simple way to do this is to check the projected bounds of the input
  143. map in the current location's projection using the <b>-p</b>
  144. flag. The <b>-g</b> flag reports the same thing, but in a form which
  145. can be directly cut and pasted into
  146. a <em><a href="g.region.html">g.region</a></em> command. After setting
  147. the region in that way you might check the cell resolution with
  148. "<em>g.region -p</em>" then snap it to a regular grid
  149. with <em><a href="g.region.html">g.region</a></em>'s <b>-a</b>
  150. flag. E.g.
  151. <tt>g.region -a res=5 -p</tt>. Note that this is just a rough guide.
  152. <p>A more involved, but more accurate, way to do this is to generate a
  153. vector "box" map of the region in the source location using
  154. <em><a href="v.in.region.html">v.in.region -d</a></em>.
  155. This "box" map is then reprojected into the target location with
  156. <em><a href="v.proj.html">v.proj</a></em>. Next the region in the
  157. target location is set to the extent of the new vector map
  158. with <em><a href="g.region.html">g.region</a></em> along with the
  159. desired raster resolution (<em>g.region -m</em> can be used in
  160. Latitude/Longitude locations to measure the geodetic length of a
  161. pixel).
  162. <em>r.proj</em> is then run for the raster map the user wants to
  163. reproject. In this case a little preparation goes a long way.
  164. <p>When reprojecting whole-world maps the user should disable
  165. map-trimming with the <b>-n</b> flag. Trimming is not useful here
  166. because the module has the whole map in memory anyway. Besides that,
  167. world "edges" are hard (or impossible) to find in projections other
  168. than latitude-longitude so results may be odd with trimming.
  169. <h2>EXAMPLES</h2>
  170. <h3>Inline method</h3>
  171. With GRASS running in the destination location use the <b>-g</b> flag
  172. to show the input map's bounds once projected into the current working
  173. projection, then use that to set the region bounds before performing
  174. the reprojection:
  175. <div class="code"><pre>
  176. # calculate where output map will be
  177. r.proj input=elevation location=ll_wgs84 mapset=user1 -p
  178. Source cols: 8162
  179. Source rows: 12277
  180. Local north: -4265502.30382993
  181. Local south: -4473453.15255565
  182. Local west: 14271663.19157564
  183. Local east: 14409956.2693866
  184. # same calculation, but in a form which can be cut and pasted into a g.region call
  185. r.proj input=elevation location=ll_wgs84 mapset=user1 -g
  186. n=-4265502.30382993 s=-4473453.15255565 w=14271663.19157564 e=14409956.2693866 rows=12277 cols=8162
  187. g.region n=-4265502.30382993 s=-4473453.15255565 \
  188. w=14271663.19157564 e=14409956.2693866 rows=12277 cols=8162 -p
  189. projection: 99 (Mercator)
  190. zone: 0
  191. datum: wgs84
  192. ellipsoid: wgs84
  193. north: -4265502.30382993
  194. south: -4473453.15255565
  195. west: 14271663.19157564
  196. east: 14409956.2693866
  197. nsres: 16.93824621
  198. ewres: 16.94352828
  199. rows: 12277
  200. cols: 8162
  201. cells: 100204874
  202. # round resolution to something cleaner
  203. g.region res=17 -a -p
  204. projection: 99 (Mercator)
  205. zone: 0
  206. datum: wgs84
  207. ellipsoid: wgs84
  208. north: -4265487
  209. south: -4473465
  210. west: 14271653
  211. east: 14409965
  212. nsres: 17
  213. ewres: 17
  214. rows: 12234
  215. cols: 8136
  216. cells: 99535824
  217. # finally, perform the reprojection
  218. r.proj input=elevation location=ll_wgs84 mapset=user1 memory=800
  219. </pre></div>
  220. <h3>v.in.region method</h3>
  221. <div class="code"><pre>
  222. # In the source location, use v.in.region to generate a bounding box around the
  223. # region of interest:
  224. v.in.region -d output=bounds type=area
  225. # Now switch to the target location and import the vector bounding box
  226. # (you can run v.proj -l to get a list of vector maps in the source location):
  227. v.proj input=bounds location=source_location_name output=bounds_reprojected
  228. # Set the region in the target location with that of the newly-imported vector
  229. # bounds map, and align the resolution to the desired cell resolution of the
  230. # final, reprojected raster map:
  231. g.region vector=bounds_reprojected res=5 -a
  232. # Now reproject the raster into the target location
  233. r.proj input=elevation.dem output=elevation.dem.reproj \
  234. location=source_location_name mapset=PERMANENT res=5 method=bicubic
  235. </pre></div>
  236. <h2>REFERENCES</h2>
  237. <ol>
  238. <li> Evenden, G.I. (1990) <a href="http://proj.osgeo.org">Cartographic
  239. projection procedures for the UNIX environment - a user's manual.</a>
  240. USGS Open-File Report 90-284 (OF90-284.pdf)
  241. See also there: Interim Report and 2nd Interim Report on Release 4, Evenden 1994).
  242. <li> Richards, John A. (1993), Remote Sensing Digital Image Analysis,
  243. Springer-Verlag, Berlin, 2nd edition.
  244. </ol>
  245. <a href="http://trac.osgeo.org/proj/">PROJ 4</a>: Projection/datum support library.
  246. <p>
  247. <b>Further reading</b>
  248. <ul>
  249. <li> <a href="http://www.asprs.org/Grids-Datums.html">ASPRS Grids and Datum</a>
  250. <li> <a href="http://www.remotesensing.org/geotiff/proj_list/">Projections Transform List</a> (PROJ.4)
  251. <li> <a href="http://www.mapref.org">MapRef -
  252. The Collection of Map Projections and Reference Systems for Europe</a>
  253. <li> <a href="http://www.crs-geo.eu">Information and Service System for European Coordinate Reference Systems - CRS</a>
  254. <li> <a href="http://www.progonos.com/furuti/MapProj/Normal/TOC/cartTOC.html">Cartographical Map Projections</a> by Carlos A. Furuti
  255. </ul>
  256. <h2>SEE ALSO</h2>
  257. <em>
  258. <a href="g.region.html">g.region</a>,
  259. <a href="g.proj.html">g.proj</a>,
  260. <a href="i.rectify.html">i.rectify</a>,
  261. <a href="m.proj.html">m.proj</a>,
  262. <a href="r.support.html">r.support</a>,
  263. <a href="r.stats.html">r.stats</a>,
  264. <a href="v.proj.html">v.proj</a>,
  265. <a href="v.in.region.html">v.in.region</a>
  266. </em>
  267. <p>
  268. The 'gdalwarp' and 'gdal_translate' utilities are available from the
  269. <a href="http://www.gdal.org">GDAL</a> project.
  270. <h2>AUTHORS</h2>
  271. Martin Schroeder, University of Heidelberg, Germany<br>
  272. Man page text from S.J.D. Cox, AGCRC, CSIRO Exploration &amp; Mining, Nedlands, WA<br>
  273. Updated by <a href="mailto:morten@untamo.net">Morten Hulden</a><br>
  274. Datum transformation support and cleanup by Paul Kelly
  275. <p><i>Last changed: $Date$</i>