NAME

m.proj2 - Calculates conversion coordinates for geographic positions.
(GRASS Map Development Program)

SYNOPSIS

m.proj2
m.proj2 help
m.proj2 [-i] [-o] [-d] [input=name] [output=name] [inproj=name[,name,...]] [outproj=name[,name,...]]

Flags:

-i
Use WGS84 as input and current location as output projection
-o
Use current location as input and WGS84 as output projection
-d
Output lat/long in decimal degrees

Parameters:

input
Input coordinate file
output
Output coordinate file
inproj
Comma separated input projection parameters
outproj
Comma separated output projection parameters

DESCRIPTION

This program allows a user to (optionally interactively) convert coordinates from one projection to another. It allows a user to take coordinates from one file, convert them, and then write the results to another file. Alternatively, if the input= and/or output= options are omitted, eastings and northings may be passed to the program from stdin and results sent to stdout. In this way m.proj2 can be used as a simple replacement for the PROJ.4 cs2cs program, especially when used with the -i or -o flags. Be sure to send it the x value first, i.e., "longitude latitude".

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.

USAGE EXAMPLES

To convert a WGS84 lat/long coordinate to the current map projection:
    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.txt
or 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.txt
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).

For more usage examples, see documentation for the PROJ.4 'cs2cs' program.

BUGS

Please report any you find. Projection and datum support has been drastically changed (for the better) in recent versions of GRASS.

References:

[1] Evenden, G.I. (1990) Cartographic projection procedures for the UNIX environment - a user's manual. USGS Open-File Report 90-284 (Also see Interim Report and 2nd Interim Report on Release 4, Evenden 1994).

[2] PROJ.4 software

SEE ALSO

m.proj, s.proj, v.proj, r.proj, g.projinfo, g.setproj, i.rectify, i.rectify3

AUTHORS

Bob Covill, code based on m.proj
Updates by Paul Kelly and Hamish Bowman

Last changed: $Date: 2004/07/28 23:59:41 $