g.proj.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <h2>DESCRIPTION</h2>
  2. <p><em>g.proj</em> provides a means of converting a co-ordinate system
  3. description (i.e. projection information) between various formats.
  4. If compiled without <a href="http://www.gdal.org/ogr/">OGR</a> present, the
  5. functionality is limited to:
  6. <ul>
  7. <li>Reporting the projection information for the current location,
  8. either in conventional GRASS (-p flag) or PROJ.4 (-j flag) format</li>
  9. <li>Changing the datum, or reporting and modifying the datum transformation
  10. parameters, for the current location</li>
  11. </ul>
  12. <p>When compiled with OGR, functionality is increased and allows output of
  13. the projection information in the Well-Known Text (WKT) format popularised
  14. by proprietary GIS. In addition, if one of the parameters <em>georef</em>,
  15. <em>wkt</em>, <em>proj4</em> or <em>epsg</em> is specified, rather than the
  16. projection information being read from the current location it is imported
  17. from an external source as follows:
  18. <dl>
  19. <dt>georef=<em>filename</em></dt>
  20. <dd><em>g.proj</em> attempts to invoke GDAL and OGR in turn to read a
  21. georeferenced file <em>filename</em>. The projection information will be
  22. read from this file. If the file is not georeferenced or cannot be read,
  23. XY (unprojected) will be used.</dd>
  24. <dt>wkt=<em>filename</em> or <em>-</em></dt>
  25. <dd>The file <em>filename</em> should contain a projection description in WKT
  26. format with or without line-breaks (e.g. a '.prj' file). If <em>-</em> is given
  27. for the filename, the WKT description will be read from stdin rather than a
  28. file.</dd>
  29. <dt>proj4=<em>description</em> or <em>-</em></dt>
  30. <dd><em>description</em> should be a projection description in
  31. <a href="http://proj.osgeo.org/">PROJ.4</a> format, enclosed in
  32. quotation marks if there are any spaces. If <em>-</em> is given for
  33. <em>description</em>, the PROJ.4 description will be read from stdin rather
  34. than as a directly-supplied command-line parameter.</dd>
  35. <dt>epsg=<em>number</em></dt>
  36. <dd><em>number</em> should correspond to the index number of a valid
  37. co-ordinate system in the <a href="http://www.epsg.org/CurrentDB.html">EPSG
  38. database</a>. EPSG code support is based upon a local copy of the GDAL CSV
  39. co-ordinate system and datum information files, stored in the directory
  40. <tt>$GISBASE/etc/proj/ogr_csv</tt>. These can be updated if necessary
  41. to support future revisions of the EPSG database.</dd>
  42. </dl>
  43. <p>If datum information is incorrect or missing in the input
  44. co-ordinate system definition (e.g. PROJ.4 descriptions have very limited
  45. support for specifying datum names), a GRASS datum abbreviation can instead be
  46. supplied using the <em>datum</em> parameter. This will override any
  47. datum contained in the input co-ordinate system, and discard
  48. any datum transformation parameters. Enter datum=<em>list</em> to return a
  49. list of all the datums supported by GRASS. Since any
  50. existing datum transformation parameters will have been discarded, the
  51. <em>datumtrans</em> parameter should in general always be used in
  52. conjunction with <em>datum</em>.
  53. <p>The -p, -j, -w, etc. flags are all functional when importing projection
  54. information from an external source, meaning that <em>g.proj</em> can be
  55. used to convert between representations of the information. It is
  56. <strong>not</strong> required that either the input or output be in GRASS
  57. format.
  58. <p>In addition however, if the -c flag is specified, <em>g.proj</em> will
  59. create new GRASS projection files (PROJ_INFO, PROJ_UNITS, WIND and
  60. DEFAULT_WIND) based on the imported information. If the <em>location</em>
  61. parameter is specified in addition to -c, then a new location will be created.
  62. Otherwise the projection information files in the current location will be
  63. overwritten. The program will <strong>not</strong> warn before doing this.
  64. <p>The final mode of operation of g.proj is to report on the datum
  65. information and datum transformation parameters associated with the
  66. co-ordinate system. The -d flag will report a human-readable summary of
  67. this.
  68. <h2>NOTES</h2>
  69. <p>If the input co-ordinate system contains a datum name but no
  70. transformation parameters, and there is more than one suitable parameter set
  71. available (according to the files datum.table and datumtransform.table in
  72. <tt>$GISBASE/etc/proj</tt>), <em>g.proj</em> will check the value of
  73. the <em>datumtrans</em> option and act according to the following:<br>
  74. <strong>-1:</strong> List available parameter sets in a GUI-parsable (but also
  75. human-readable) format and exit.<br>
  76. <strong>0 (default):</strong> Continue without specifying parameters - if
  77. used when creating a location, other GRASS modules will use the "default"
  78. (likely non-optimum) parameters for this datum if necessary in the future.<br>
  79. <strong>Any other number less than or equal to the number of parameter sets
  80. available for this datum:</strong> Choose this parameter set and add it to the
  81. co-ordinate system description.<br>
  82. If the <em>-t</em> flag is specified, the module will attempt to change the
  83. datum transformation parameters using one of the above two methods
  84. <strong>even if</strong> a valid parameter set is already specified in the
  85. input co-ordinate system. This can be useful to change the datum information
  86. for an existing location.
  87. <p>Output is simply based on the input projection information. g.proj does
  88. <strong>not</strong> attempt to verify that the co-ordinate system thus
  89. described matches an existing system in use in the world. In particular,
  90. this means there are no EPSG Authority codes in the WKT output.
  91. <p>WKT format shows the false eastings and northings in the projected unit
  92. (e.g. meters, feet) but in PROJ format it should always be given in meters.
  93. <p>The maximum size of input WKT or PROJ.4 projection descriptions is
  94. limited to 8000 bytes.
  95. <h2>EXAMPLES</h2>
  96. Print the projection information for the current location:<br>
  97. <div class="code"><pre>
  98. g.proj -p
  99. </pre></div>
  100. <p>Create a '.prj' file in ESRI format corresponding to the current location:<br>
  101. <div class="code"><pre>
  102. g.proj -wef > irish_grid.prj
  103. </pre></div>
  104. <p>Read the projection information from a geotiff file and print it in PROJ.4
  105. format:<br>
  106. <div class="code"><pre>
  107. g.proj -jf georef=ASTER_DEM20020508161837.tif
  108. </pre></div>
  109. <p>Convert the PROJ.4 projection description contained in a text file to WKT
  110. format:<br>
  111. <div class="code"><pre>
  112. cat proj4.description | g.proj -w proj4=-
  113. </pre></div>
  114. <p>Create a new location with the co-ordinate system referred to by EPSG code
  115. 4326 (Latitude-Longitude/WGS84), without explicitly specifiying datum
  116. transformation parameters:<br>
  117. <div class="code"><pre>
  118. g.proj -c epsg=4326 location=latlong
  119. </pre></div>
  120. <p>Create a new location with the co-ordinate system referred to by ESRI-EPSG code
  121. 900913 (<a href="http://spatialreference.org/ref/user/6/">Google Mercator Projection</a>)<br>
  122. <div class="code"><pre>
  123. g.proj -c epsg=900913 loc=google
  124. </pre></div>
  125. <p>Create a new location with the co-ordinate system referred to by EPSG code
  126. 29900 (Irish Grid), selecting datum transformation parameter set no. 2:<br>
  127. <div class="code"><pre>
  128. g.proj -c epsg=29900 datumtrans=2 location=irish_grid
  129. </pre></div>
  130. <p>Create a new location with the same co-ordinate system as the current
  131. location, but forcing a change to datum transformation parameter set no. 1:<br>
  132. <div class="code"><pre>
  133. g.proj -c location=newloc -t datumtrans=1
  134. </pre></div>
  135. <p>List the possible datum transformation parameters for the current location:<br>
  136. <div class="code"><pre>
  137. g.proj -t datumtrans=-1
  138. </pre></div>
  139. <p>Create a new location with the co-ordinate system from a WKT definition
  140. stored in a text file:<br>
  141. <div class="code"><pre>
  142. g.proj -c wkt=irish_grid.prj location=irish_grid
  143. </pre></div>
  144. <p>Create a new location from a PROJ.4 description, explicitly
  145. specifying a datum and using the default datum transformation
  146. parameters:<br>
  147. <div class="code"><pre>
  148. g.proj -c location=spain proj4="+proj=utm +zone=30 +ellps=intl" datum=eur50 datumtrans=0
  149. </pre></div>
  150. <p>Reproject external raster map to current GRASS projection (does not always make sense!)
  151. using the GDAL 'gdalwarp' tool. We recommend to use the ERDAS/Img format and not
  152. to use the ESRI style of WKT:<br>
  153. <div class="code"><pre>
  154. # example for 30x30 pixel resolution (enforce with -tr to avoid odd values)
  155. gdalwarp -of HFA -tr 30 30 -t_srs "`g.proj -wf`" aster.img aster_tmerc.img
  156. </pre></div>
  157. <p>Reproject external vector map to current GRASS projection
  158. using the OGR 'ogr2ogr' tool:<br>
  159. <div class="code"><pre>
  160. ogr2ogr -t_srs "`g.proj -wf`" polbnda_italy_GB_ovest.shp polbnda_italy_LL.shp
  161. </pre></div>
  162. <h2>REFERENCES</h2>
  163. <a href="http://proj.maptools.org">PROJ 4</a>: Projection/datum support library<br>
  164. <a href="http://www.gdal.org">GDAL raster library and toolset</a><br>
  165. <a href="http://www.gdal.org/ogr/">OGR vector library and toolset</a>
  166. <p><b>Further reading</b>
  167. <ul>
  168. <li> <a href="http://www.asprs.org/persjournals/PE-RS-Journals/Grids-Datums.html">ASPRS Grids and Datum</a>
  169. <li> <a href="http://www.mapref.org">MapRef - The Collection of Map Projections and Reference Systems for Europe</a>
  170. <li> <a href="http://www.remotesensing.org/geotiff/proj_list/">Projections Transform List</a> (PROJ4)
  171. </ul>
  172. <h2>SEE ALSO</h2>
  173. <em><a href="g.setproj.html">g.setproj</a></em><br>
  174. <em><a href="r.in.gdal.html">r.in.gdal</a></em><br>
  175. <em><a href="v.in.ogr.html">v.in.ogr</a></em>
  176. <h2>AUTHOR</h2>
  177. Paul Kelly
  178. <p><i>Last changed: $Date$</i>