1m.proj(1) Grass User's Manual m.proj(1)
2
3
4
6 m.proj - Convert coordinates from one projection to another (cs2cs
7 frontend).
8
10 miscellaneous, projection
11
13 m.proj
14 m.proj help
15 m.proj [-iodv] [input=filename] [output=filename] [fs=character]
16 [proj_in=string] [proj_out=string] [--verbose] [--quiet]
17
18 Flags:
19 -i
20 Use LL WGS84 as input and current location as output projection
21
22 -o
23 Use current location as input and LL WGS84 as output projection
24
25 -d
26 Output long/lat in decimal degrees or other projections with many
27 decimal places
28
29 -v
30 Verbose mode (print projection parameters and filenames to stderr)
31
32 --verbose
33 Verbose module output
34
35 --quiet
36 Quiet module output
37
38 Parameters:
39 input=filename
40 Input coordinate file (omit to read from stdin)
41
42 output=filename
43 Output coordinate file (omit to send to stdout)
44
45 fs=character
46 Field separator
47 Default: |
48
49 proj_in=string
50 Input projection parameters (PROJ.4 style)
51
52 proj_out=string
53 Output projection parameters (PROJ.4 style)
54
56 This program allows a user to convert coordinates from one projection
57 to another. Coordinates can be read from one file, converted, and
58 results written to another file. Alternatively, if the input and/or
59 output options are omitted, eastings and northings may be passed to the
60 program directly from stdin and results sent directly to stdout. In
61 this way m.proj can be used as a simple frontend to the PROJ.4 cs2cs
62 utility. The -i or -o flags make the task especially easy for the com‐
63 mon problem of converting to or from lat/long WGS84.
64
65 Note: This program does not transform GRASS maps, it is designed to
66 determine the equivalent coordinate values of an individual position or
67 list of positions. Use v.proj or r.proj to reproject GRASS maps.
68
70 cs2cs expects input data to formatted as "x y", so if working with lat‐
71 itude-longitude data be sure to send the x value first, i.e., "longi‐
72 tude latitude". Output data will be exported using the same convention.
73
74 cs2cs will treat a third data column as a z value (elevation) and will
75 modify the value accordingly. This usually translates into small but
76 real differences in that data column.
77
78 cs2cs does not expect the input stream to contain column headings, only
79 numbers. If your data file has lines you wish to have passed through
80 without being processed, they must start with the '#' character.
81
82 If sending m.proj data from stdin, be aware that the data is first
83 stored to a temporary file before being processed with cs2cs. It is
84 therefore not advisable to send m.proj data from an open data stream.
85 The module will stop listening for incoming data after 2 seconds of
86 inactivity. You may use the projection parameters gleaned from m.proj's
87 verbose mode (-v) with cs2cs directly in this case.
88
89 Custom projection parameters can be used via the proj_in and proj_out
90 options. Full documentation of the projection parameter format may be
91 found on the PROJ.4 website. Using these options will fully override
92 the default parameters the module would normally use.
93
94 By using the -v verbose flag, the user can see exactly what projection
95 parameters will be used in the conversion as well as some other infor‐
96 mative messages.
97
98 If output is to lat/long, it will be formatted using PROJ.4's
99 Degree:Minute:Second (DMS) convention of DDDdMM'SSS.SS"H. This can be
100 handy if you wish to quickly convert lat/long decimal degree data into
101 its DMS equivalent.
102 Alternatively, to have m.proj output data in decimal degrees, use the
103 -d flag. This flag can also be used with non-lat/long data to force a
104 higher number of decimal places (the cs2cs default is 2).
105
106 Lat/long output can be converted to GRASS's DMS convention
107 (DDD:MM:SSS.SSSH) by piping the results of m.proj through the sed
108 stream editor as follows.
109 m.proj -o | sed -e 's/d/:/g' -e "s/'/:/g" -e 's/"//g'
110
111
112 The m.proj module is designed to work seamlessly with point data
113 exported from the GIS with v.out.ascii, as the following example shows.
114 v.out.ascii bugsites | m.proj -o
115
116
118 To convert a WGS84 long/lat coordinate to the current map projection
119 using the -i flag to set projection parameters automaticlly:
120 GRASS> echo "170.510125 -45.868537" | m.proj -i
121 2316541.70 5479193.51 1.23
122
123
124 The same, but load points from a file named "waypoints.txt" and con‐
125 tinue on to import the results into a GRASS vector points map in the
126 current map projection:
127 m.proj -i in=waypoints.txt | cut -f1 -d' ' | v.in.ascii out=test_pt
128 fs=tab
129 Here the standard UNIX cut tool is used to discard the z residual.
130
131 To convert all coordinates from a vector points map in the current pro‐
132 jection to WGS84 long/lat, with output in decimal form:
133 v.out.ascii bugsites | m.proj -od
134
135
136 To transform points from a UTM projection into the Gauss-Krüger Grid
137 System, importing and exporting to files:
138 m.proj proj_in="+proj=utm +name=utm +a=6378137.0 +es=0.006694380 \
139 +zone=32 +unfact=1.0" proj_out="+proj=tmerc +name=tmerc \
140 +a=6377397.155 +es=0.0066743720 +lat_0=0.0 +lon_0=9.0 +k=1.0 \
141 +x_0=3500000.0" input=utm.coord.txt output=new.gk.coord.txt
142
143
144 Projection parameters provided in the above case: "+proj" (projection
145 type), "+name" (projection name), "+a" (ellipsoid: equatorial radius),
146 "+es" (ellipsoid: eccentricity squared), "+zone" (zone for the area),
147 "+unfact" (conversion factor from meters to other units, e.g. feet),
148 "+lat_0" (standard parallel), "+lon_0" (central meridian), "+k" (scale
149 factor) and "+x_0" (false easting). Sometimes false northing is needed
150 which is coded as "+y_0". Internally, the underlying PROJ.4 projection
151 library performs an inverse projection to latitude-longitude and then
152 projects the coordinate list to the target projection.
153
154 Datum conversions are automatically handled by the PROJ.4 library if
155 "+datum" setings are specified on both the input and output projections
156 on the command line. The "+towgs84" parameter can be used to define
157 either 3 or 7 term datum transform coefficients, satisfying this
158 requirement.
159
160 If a datum is specified there is no need for the '+ellps=' or underly‐
161 ing parameters, '+a=', '+es=', etc.
162
163 Another custom parameter usage example:
164
165 m.proj proj_in="+proj=tmerc +datum=ire65 +lat_0=53.5 +lon_0=-8
166 +x_0=200000 \
167 +y_0=250000 +k=1.000035" proj_out="+proj=ll +datum=wgs84"
168 input=wpt.txt
169 or without datum transformation:
170 m.proj proj_in="+proj=tmerc +ellps=modif_airy +lat_0=53.5 +lon_0=-8
171 +x_0=200000 \
172 +y_0=250000 +k=1.000035" proj_out="+proj=ll +datum=wgs84"
173 input=wpt.txt
174
175
176 In this example no datum transformation will take place as a datum was
177 not specified for the input projection. The datum specified for the
178 output projection will thus be silently ignored and may be left out;
179 all that is achieved a simple conversion from projected to geodetic co-
180 ordinates, keeping the same datum (and thus also the same ellipsoid).
181
182 For more usage examples, see the documentation for the PROJ.4 cs2cs
183 program.
184
186 [1] Evenden, G.I. (1990) Cartographic projection procedures for the
187 UNIX environment - a user's manual. USGS Open-File Report 90-284
188 (OF90-284.pdf) See also there: Interim Report and 2nd Interim Report on
189 Release 4, Evenden 1994).
190
191 [2] PROJ.4 Cartographic Projection Library
192
194 v.proj, r.proj, g.proj, g.setproj, i.rectify, v.in.ascii, v.out.ascii
195
197 M. Hamish Bowman, Dept. Marine Science, Otago University, New Zealand
198 Functionality inspired by the m.proj and m.proj2 modules for GRASS GIS
199 5.
200
201 Last changed: $Date: 2006-08-31 10:47:06 +0200 (Thu, 31 Aug 2006) $
202
203 Full index
204
205 © 2003-2008 GRASS Development Team
206
207
208
209GRASS 6.3.0 m.proj(1)