123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <h2>DESCRIPTION</h2>
- This program allows a user to convert coordinates from one projection
- to another. Coordinates can be read from one file, converted, and
- results written to another file. Alternatively, if the <b>input=-</b>,
- eastings and northings may be passed to the program directly from
- standard input. If the <b>output</b> option is omitted, the results
- are sent directly to standard output. In this way <em>m.proj</em> can
- be used as a simple frontend to
- the <a href="http://trac.osgeo.org/proj/">PROJ.4</a>
- <em>cs2cs</em> utility. The <b>-i</b> or <b>-o</b> flags make the task
- especially easy for the common problem of converting to or from lat/long
- WGS84.
- <p>
- <i>Note</i>: This program does not transform GRASS maps, it is
- designed to determine the equivalent coordinate values of an
- individual position or list of
- positions. Use <em><a href="v.proj.html">v.proj</a></em> to reproject
- vector maps or <em><a href="r.proj.html">r.proj<a/></em> for raster maps.
- <h2>NOTES</h2>
- <em>cs2cs</em> expects input data to formatted as <tt>x y</tt>, so if
- working with latitude-longitude data be sure to send the <tt>x</tt>
- value first, i.e., <tt>longitude latitude</tt>. Output data will
- be exported using the same convention.
- <p>
- <em>cs2cs</em> will treat a third data column as a <tt>z</tt> value
- (elevation) and will modify the value accordingly. This usually
- translates into small but real differences in that data column.
- <p>
- <em>cs2cs</em> does not expect the input stream to contain column
- headings, only numbers. If your data file has lines you wish to have
- passed through without being processed, they must start with the
- '<tt>#</tt>' character.
- <p>
- If sending <em>m.proj</em> data from standard input, be aware that the
- data is first stored to a temporary file before being processed
- with <em>cs2cs</em>. It is therefore not advisable to
- send <em>m.proj</em> data from an open data stream. The module will
- stop listening for incoming data after 2 seconds of inactivity. You
- may use the projection parameters gleaned from <em>m.proj</em>'s
- verbose mode (<b>--verbose</b>) with <em>cs2cs</em> directly in this case.
- <p>
- Custom projection parameters can be used via the <b>proj_in</b> and
- <b>proj_out</b> options. Full documentation of the projection
- parameter format may be found on
- the <a href="http://trac.osgeo.org/proj/">PROJ.4</a> website. Using
- these options will fully override the default parameters the module
- would normally use.
- <p>
- By using the <b>--verbose</b> verbose flag, the user can see exactly
- what projection parameters will be used in the conversion as well as
- some other informative messages.
- <p>
- If output is to lat/long, it will be formatted using PROJ.4's
- Degree:Minute:Second (DMS) convention
- of <tt>DDDdMM'SSS.SS"H</tt>. This can be handy if you wish to quickly
- convert lat/long decimal degree data into its DMS equivalent.<br>
- Alternatively, to have <em>m.proj</em> output data in decimal degrees,
- use the <b>-d</b> flag. This flag can also be used with non-lat/long
- data to force a higher number of decimal places (the <em>cs2cs</em>
- default is 2).
- <h2>EXAMPLES</h2>
- Lat/long output can be converted to GRASS's DMS convention
- (<tt>DDD:MM:SSS.SSSH</tt>) by piping the results of <em>m.proj</em>
- through the <em>sed</em> stream editor as follows.
- <div class="code"><pre>
- m.proj -o | sed -e 's/d/:/g' -e "s/'/:/g" -e 's/"//g'
- </pre></div>
- <p>
- The <em>m.proj</em> module is designed to work seamlessly with point
- data exported from the GIS
- with <em><a href="v.out.ascii.html">v.out.ascii</a></em>, as the
- following example shows.
- <div class="code"><pre>
- v.out.ascii bugsites | m.proj -o
- </pre></div>
- <p>
- To convert a WGS84 long/lat coordinate to the current map projection
- using the <b>-i</b> flag to set projection parameters automatically:
- <div class="code"><pre>
- GRASS> echo "170.510125 -45.868537" | m.proj -i
- 2316541.70 5479193.51 1.23
- </pre></div>
- <p>
- The same, but load points from a file named <tt>waypoints.txt</tt> and
- continue on to import the results into a GRASS vector points map in
- the current map projection:
- <div class="code"><pre>
- m.proj -i in=waypoints.txt | cut -f1 -d' ' | v.in.ascii out=test_pt separator=tab
- </pre></div>
- Here the standard UNIX <em>cut</em> tool is used to discard
- the <tt>z</tt> residual.
- <p>
- To convert all coordinates from a vector points map in the current
- projection to WGS84 long/lat, with output in decimal form:
- <div class="code"><pre>
- v.out.ascii bugsites | m.proj -od
- </pre></div>
- <p>
- To transform points from a UTM projection into the Gauss-Krüger
- Grid System, importing and exporting to files:
- <div class="code"><pre>
- m.proj proj_in="+proj=utm +name=utm +a=6378137.0 +es=0.006694380 \
- +zone=32 +unfact=1.0" proj_out="+proj=tmerc +name=tmerc \
- +a=6377397.155 +es=0.0066743720 +lat_0=0.0 +lon_0=9.0 +k=1.0 \
- +x_0=3500000.0" input=utm.coord.txt output=new.gk.coord.txt
- </pre></div>
- <p>
- Projection parameters provided in the above case: <tt>+proj</tt>
- (projection type), <tt>+name</tt> (projection name), <tt>+a</tt>
- (ellipsoid: equatorial radius), <tt>+es</tt> (ellipsoid:
- eccentricity squared), <tt>+zone</tt> (zone for the area),
- <tt>+unfact</tt> (conversion factor from meters to other units,
- e.g. feet), <tt>+lat_0</tt> (standard parallel), <tt>+lon_0</tt>
- (central meridian), <tt>+k</tt> (scale factor) and <tt>+x_0</tt>
- (false easting). Sometimes false northing is needed which is coded as
- <tt>+y_0</tt>. Internally, the underlying
- <a href="http://trac.osgeo.org/proj/">PROJ.4</a> projection library
- performs an inverse projection to latitude-longitude and then projects
- the coordinate list to the target projection.
- <p>
- <!-- HB 4/2006: I'm leaving this in from the GRASS 5 help page, but is
- it accurate? --> Datum conversions are automatically handled by the
- PROJ.4 library if
- <tt>+datum</tt> setings are specified on <b>both</b> the input <b>and</b> output
- projections on the command line. The <tt>+towgs84</tt> parameter can be used to
- define either 3 or 7 term datum transform coefficients, satisfying this requirement.
- <p>If a datum is specified there is no need for the <tt>+ellps=</tt> or underlying
- parameters, <tt>+a=</tt>, <tt>+es=</tt>, etc.
- <p>
- Another custom parameter usage example:
- <div class="code"><pre>
- m.proj proj_in="+proj=tmerc +datum=ire65 +lat_0=53.5 +lon_0=-8 +x_0=200000 \
- +y_0=250000 +k=1.000035" proj_out="+proj=ll +datum=wgs84" input=wpt.txt
- </pre></div>
- or without datum transformation:
- <div class="code"><pre>
- m.proj proj_in="+proj=tmerc +ellps=modif_airy +lat_0=53.5 +lon_0=-8 +x_0=200000 \
- +y_0=250000 +k=1.000035" proj_out="+proj=ll +datum=wgs84" input=wpt.txt
- </pre></div>
- <p>
- In this example no datum transformation will take place as a datum was
- not specified for the input projection. The datum specified for the
- output projection will thus be silently ignored and may be left out;
- all that is achieved a simple conversion from projected to geodetic
- co-ordinates, keeping the same datum (and thus also the same
- ellipsoid).
- <p>
- For more usage examples, see the documentation for the
- <a href="http://trac.osgeo.org/proj/">PROJ.4</a> <em>cs2cs</em> program.
- <h2>REFERENCES</h2>
- <ul>
- <li>Evenden, G.I.
- (1990) <a href="ftp://ftp.remotesensing.org/proj/OF90-284.pdf">Cartographic
- projection procedures for the UNIX environment - a user's
- manual</a>. USGS Open-File Report 90-284 (OF90-284.pdf) See
- also there: Interim Report and 2nd Interim Report on Release 4,
- Evenden 1994).</li>
- <li><a href="http://trac.osgeo.org/proj/">PROJ.4</a> Cartographic Projection Library</li>
- </ul>
- <h2>SEE ALSO</h2>
- <em>
- <a href="v.proj.html">v.proj</a>,
- <a href="r.proj.html">r.proj</a>,
- <a href="g.proj.html">g.proj</a>,
- <!--<a href="g.setproj.html">g.setproj</a>,-->
- <a href="i.rectify.html">i.rectify</a>,
- <!-- <a href="i.rectify3.html">i.rectify3</a> -->
- <a href="v.in.ascii.html">v.in.ascii</a>,
- <a href="v.out.ascii.html">v.out.ascii</a>
- </em>
- <h2>AUTHOR</h2>
- M. Hamish Bowman, Dept. Marine Science, Otago University, New Zealand<br>
- Functionality inspired by the <em>m.proj</em> and <em>m.proj2</em> modules for
- GRASS GIS 5.
- <p>
- <i>Last changed: $Date$</i>
|