description.html 8.2 KB

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