Note: The program does not transform GRASS files, it is designed to determine coordinate values on an individual position or list of positions. Use s.proj, v.proj, and r.proj to reproject GRASS maps.
GRASS:~ > echo "170.510125 -45.868537" | m.proj2 -i Assuming LL WGS84 as input, current projection as output. 2316540.779291 5479191.917030
To convert a list of WGS84 lat/long GPS coordinates in a text file (including any attributes) into a GRASS sites file in the current map projection:
GRASS:~ > cat waypoints.txt | m.proj2 -i | s.in.ascii sitesfile
To convert all coordinates from a sites file in the current projection to WGS84 lat/long, with output in decimal form:
GRASS:~ > s.out.ascii -a sitesfile | m.proj2 -od
To transform points from a UTM projection into the
Gauss-Krüger Grid System, importing and exporting to files:
GRASS:~ > m.proj2 inproj="proj=utm,name=utm,a=6378137.0,es=0.006694380,\ zone=32,unfact=1.0" outproj="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 output=new.gk.coord
Projection parameters provided in the above case: "proj"
(projection type), "name" (projection name), "a" (ellipsoid: equatorial
radius), "es" (ellipsoid: eccentricity squared), "zone" (zone for the
area), "unfact" (conversion factor from meters to other units, e.g. feet),
"lat_0" (standard parallel), "lon_0" (central meridian), "k" (scale
factor) and "x_0" (false easting). Sometimes false northing is needed which
is coded as "y_0". Internally, the underlying
PROJ.4 projection library
performs an inverse projection to latitude-longitude and then projects the
coordinate list to the target projection.
Note: NO column headings are required, just the numbers.
Datum conversions are automatically handled by the PROJ.4 library, if 'datum=' is specified in both the input and output projections on the command line. (N.B. When using the command interactively, the user will not be asked for a datum, and datum transformation will not take place.)
If a datum is specified there is no need for the 'ellps=' or underlying parameters, 'a=', 'es=' etc.
Another Usage example:
GRASS:~ > m.proj2 inproj="proj=tmerc,datum=ire65,lat_0=53.5,lon_0=-8,x_0=200000,\ y_0=250000,k=1.000035" outproj="proj=ll,datum=wgs84" input=test.txtor without datum transformation:
GRASS:~ > m.proj2 inproj="proj=tmerc,ellps=modif_airy,lat_0=53.5,lon_0=-8,x_0=200000,\ y_0=250000,k=1.000035" outproj="proj=ll,datum=wgs84" input=test.txtIn 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).
For more usage examples, see documentation for the PROJ.4 'cs2cs' program.
[2] PROJ.4 software
Last changed: $Date: 2004/07/28 23:59:41 $