g.proj.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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>Reporting and modifying the datum transformation parameters for
  10. 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://remotesensing.org/proj/">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>The -p, -j, -w, etc. flags are all functional when importing projection
  44. information from an external source, meaning that <em>g.proj</em> can be
  45. used to convert between representations of the information. It is
  46. <strong>not</strong> required that either the input or output be in GRASS
  47. format.
  48. <p>In addition however, if the -c flag is specified, <em>g.proj</em> will
  49. create new GRASS projection files (PROJ_INFO, PROJ_UNITS, WIND and
  50. DEFAULT_WIND) based on the imported information. If the <em>location</em>
  51. parameter is specified in addition to -c, then a new location will be created.
  52. Otherwise the projection information files in the current location will be
  53. overwritten. The program will <strong>not</strong> warn before doing this.
  54. <p>The final mode of operation of g.proj is to report on the datum
  55. information and datum transformation parameters associated with the
  56. co-ordinate system. The -d flag will report a human-readable summary of
  57. this.
  58. <h2>NOTES</h2>
  59. <p>If the input co-ordinate system contains a datum name but no
  60. transformation parameters, and there is more than one suitable parameter set
  61. available (according to the files datum.table and datumtransform.table in
  62. <tt>$GISBASE/etc/proj</tt>), <em>g.proj</em> will check the value of
  63. the <em>datumtrans</em> option and act according to the following:<br>
  64. <strong>-1:</strong> List available parameter sets in a GUI-parsable (but also
  65. human-readable) format and exit.<br>
  66. <strong>0 (default):</strong> Continue without specifying parameters - if
  67. used when creating a location, other GRASS modules will use the "default"
  68. (likely non-optimum) parameters for this datum if necessary in the future.<br>
  69. <strong>Any other number less than or equal to the number of parameter sets
  70. available for this datum:</strong> Choose this parameter set and add it to the
  71. co-ordinate system description.<br>
  72. If the <em>-t</em> flag is specified, the module will attempt to change the
  73. datum transformation parameters using one of the above two methods
  74. <strong>even if</strong> a valid parameter set is already specified in the
  75. input co-ordinate system. This can be useful to change the datum information
  76. for an existing location.
  77. <p>Output is simply based on the input projection information. g.proj does
  78. <strong>not</strong> attempt to verify that the co-ordinate system thus
  79. described matches an existing system in use in the world. In particular,
  80. this means there are no EPSG Authority codes in the WKT output.
  81. <p>WKT format shows the false eastings and northings in the projected unit
  82. (e.g. meters, feet) but in PROJ format it should always be given in meters.
  83. <p>The maximum size of input WKT or PROJ.4 projection descriptions is
  84. limited to 8000 bytes.
  85. <h2>EXAMPLES</h2>
  86. Print the projection information for the current location:<br>
  87. <div class="code"><pre>
  88. g.proj -p
  89. </pre></div>
  90. <p>Create a '.prj' file in ESRI format corresponding to the current location:<br>
  91. <div class="code"><pre>
  92. g.proj -wef > irish_grid.prj
  93. </pre></div>
  94. <p>Read the projection information from a geotiff file and print it in PROJ.4
  95. format:<br>
  96. <div class="code"><pre>
  97. g.proj -jf georef=ASTER_DEM20020508161837.tif
  98. </pre></div>
  99. <p>Convert the PROJ.4 projection description contained in a text file to WKT
  100. format:<br>
  101. <div class="code"><pre>
  102. cat proj4.description | g.proj -w proj4=-
  103. </pre></div>
  104. <p>Create a new location with the co-ordinate system referred to by EPSG code
  105. 4326 (Latitude-Longitude/WGS84), without explicitly specifiying datum
  106. transformation parameters:<br>
  107. <div class="code"><pre>
  108. g.proj -c epsg=4326 location=latlong
  109. </pre></div>
  110. <p>Create a new location with the co-ordinate system referred to by ESRI-EPSG code
  111. 900913 (<a href="http://spatialreference.org/ref/user/6/">Google Mercator Projection</a>)<br>
  112. <div class="code"><pre>
  113. g.proj -c epsg=900913 loc=google
  114. </pre></div>
  115. <p>Create a new location with the co-ordinate system referred to by EPSG code
  116. 29900 (Irish Grid), selecting datum transformation parameter set no. 2:<br>
  117. <div class="code"><pre>
  118. g.proj -c epsg=29900 datumtrans=2 location=irish_grid
  119. </pre></div>
  120. <p>Create a new location with the same co-ordinate system as the current
  121. location, but forcing a change to datum transformation parameter set no. 1:<br>
  122. <div class="code"><pre>
  123. g.proj -c location=newloc -t datumtrans=1
  124. </pre></div>
  125. <p>List the possible datum transformation parameters for the current location:<br>
  126. <div class="code"><pre>
  127. g.proj -t datumtrans=-1
  128. </pre></div>
  129. <p>Create a new location with the co-ordinate system from a WKT definition
  130. stored in a text file:<br>
  131. <div class="code"><pre>
  132. g.proj -c wkt=irish_grid.prj location=irish_grid
  133. </pre></div>
  134. <p>Reproject external raster map to current GRASS projection (does not always make sense!)
  135. using the GDAL 'gdalwarp' tool. We recommend to use the ERDAS/Img format and not
  136. to use the ESRI style of WKT:<br>
  137. <div class="code"><pre>
  138. # example for 30x30 pixel resolution (enforce with -tr to avoid odd values)
  139. gdalwarp -of HFA -tr 30 30 -t_srs "`g.proj -wf`" aster.img aster_tmerc.img
  140. </pre></div>
  141. <p>Reproject external vector map to current GRASS projection
  142. using the OGR 'ogr2ogr' tool:<br>
  143. <div class="code"><pre>
  144. ogr2ogr -t_srs "`g.proj -wf`" polbnda_italy_GB_ovest.shp polbnda_italy_LL.shp
  145. </pre></div>
  146. <h2>REFERENCES</h2>
  147. <a href="http://proj.maptools.org">PROJ 4</a>: Projection/datum support library<br>
  148. <a href="http://www.gdal.org">GDAL raster library and toolset</a><br>
  149. <a href="http://www.gdal.org/ogr/">OGR vector library and toolset</a>
  150. <p><b>Further reading</b>
  151. <ul>
  152. <li> <a href="http://www.asprs.org/resources/grids/">ASPRS Grids and Datum</a>
  153. <li> <a href="http://www.mapref.org">MapRef - The Collection of Map Projections and Reference Systems for Europe</a>
  154. <li> <a href="http://www.remotesensing.org/geotiff/proj_list/">Projections Transform List</a> (PROJ4)
  155. </ul>
  156. <h2>SEE ALSO</h2>
  157. <em><a href="g.setproj.html">g.setproj</a></em><br>
  158. <em><a href="r.in.gdal.html">r.in.gdal</a></em><br>
  159. <em><a href="v.in.ogr.html">v.in.ogr</a></em>
  160. <h2>AUTHOR</h2>
  161. Paul Kelly
  162. <p><i>Last changed: $Date$</i>