1m.proj(1)                   GRASS GIS User's Manual                  m.proj(1)
2
3
4

NAME

6       m.proj   -  Converts  coordinates from one projection to another (cs2cs
7       frontend).
8

KEYWORDS

10       miscellaneous, projection, transformation
11

SYNOPSIS

13       m.proj
14       m.proj --help
15       m.proj  [-iodec]    [coordinates=east,north]     [input=name]     [out‐
16       put=name]             [separator=character]            [proj_in=string]
17       [proj_out=string]    [--overwrite]   [--help]   [--verbose]   [--quiet]
18       [--ui]
19
20   Flags:
21       -i
22           Use LL WGS84 as input and current location as output projection
23
24       -o
25           Use current location as input and LL WGS84 as output projection
26
27       -d
28           Output  long/lat in decimal degrees, or other projections with many
29           decimal places
30
31       -e
32           Include input coordinates in output file
33
34       -c
35           Include column names in output file
36
37       --overwrite
38           Allow output files to overwrite existing files
39
40       --help
41           Print usage summary
42
43       --verbose
44           Verbose module output
45
46       --quiet
47           Quiet module output
48
49       --ui
50           Force launching GUI dialog
51
52   Parameters:
53       coordinates=east,north
54           Input coordinates to reproject
55
56       input=name
57           Name of input coordinate file
58           ’-’ for standard input
59
60       output=name
61           Name for output coordinate file (omit to send to stdout)
62
63       separator=character
64           Field separator (format: input[,output])
65           Special characters: pipe, comma, space, tab, newline
66           Default: pipe
67
68       proj_in=string
69           Input projection parameters (PROJ.4 style)
70
71       proj_out=string
72           Output projection parameters (PROJ.4 style)
73

DESCRIPTION

75       This program allows a user to convert coordinates from  one  projection
76       to  another.  Coordinates  can  be  read  from one file, converted, and
77       results written to another file. Alternatively, if the  input=-,  east‐
78       ings  and northings may be passed to the program directly from standard
79       input. If the output option is omitted, the results are  sent  directly
80       to standard output. In this way m.proj can be used as a simple frontend
81       to the PROJ cs2cs utility. The -i or -o flags make the task  especially
82       easy for the common problem of converting to or from lat/long WGS84.
83
84       Note:  This  program  does  not transform GRASS maps, it is designed to
85       determine the equivalent coordinate values of an individual position or
86       list  of  positions.  Use v.proj to reproject vector maps or r.proj for
87       raster maps.
88

NOTES

90       cs2cs expects input data to formatted as x y, so if working with  lati‐
91       tude-longitude  data  be  sure  to send the x value first, i.e., longi‐
92       tude latitude. Output data will be exported using the same convention.
93
94       cs2cs will treat a third data column as a z value (elevation) and  will
95       modify  the  value  accordingly. This usually translates into small but
96       real differences in that data column.
97
98       cs2cs does not expect the input stream to contain column headings, only
99       numbers.  If  your  data file has lines you wish to have passed through
100       without being processed, they must start with the ’#’ character.
101
102       If sending m.proj data from standard input, be aware that the  data  is
103       first stored to a temporary file before being processed with cs2cs.  It
104       is therefore not advisable to  send  m.proj  data  from  an  open  data
105       stream.  The  module will stop listening for incoming data after 2 sec‐
106       onds of inactivity. You may use the projection parameters gleaned  from
107       m.proj’s verbose mode (--verbose) with cs2cs directly in this case.
108
109       Custom  projection  parameters can be used via the proj_in and proj_out
110       options. Full documentation of the projection parameter format  may  be
111       found  on the PROJ website. Using these options will fully override the
112       default parameters the module would normally use.
113
114       By using the --verbose verbose flag, the user can see exactly what pro‐
115       jection parameters will be used in the conversion as well as some other
116       informative messages.
117
118       If  output  is  to  lat/long,  it  will  be  formatted   using   PROJ’s
119       Degree:Minute:Second  (DMS)  convention of DDDdMM’SSS.SS"H. This can be
120       handy if you wish to quickly convert lat/long decimal degree data  into
121       its DMS equivalent.
122       Alternatively,  to  have m.proj output data in decimal degrees, use the
123       -d flag. This flag can also be used with non-lat/long data to  force  a
124       higher number of decimal places (the cs2cs default is 2).
125
126       Note  that  Lat/long  output can be converted to GRASS’s DMS convention
127       (DDD:MM:SSS.SSSH) by piping the  results  of  m.proj  through  the  sed
128       stream editor as follows.
129       m.proj -o ... | sed -e ’s/d/:/g’ -e "s/’/:/g"  -e ’s/"//g’
130

EXAMPLES

132       The  examples are suitable for the North Carolina sample dataset if not
133       stated otherwise:
134
135   Reproject vector point coordinate pairs to Long/Lat WGS84
136       The m.proj module is  designed  to  work  seamlessly  with  point  data
137       exported from the GIS with v.out.ascii, as the following example shows.
138       # Long/Lat WGS84 output in DMS
139       v.out.ascii bridges | m.proj -o input=-
140       # Long/Lat WGS84 output in decimal degree
141       v.out.ascii bridges | m.proj -o -d input=-
142
143   Reproject Long/Lat WGS84 coordinate pair to current map projection
144       To  convert a Long/Lat WGS84 coordinate pair to the current map projec‐
145       tion using the -i flag which  sets  the  target  projection  parameters
146       automatically from the current location definition:
147       echo "-78.61168178 33.92225767" | m.proj -i input=-
148       645513.47|19180.31|0.00
149
150       The  same, but load points from a file named waypoints.txt and continue
151       on to import the results into a GRASS vector points map in the  current
152       map projection:
153       # check file content
154       cat waypoints.txt
155       -78.43977824 33.89587173
156       -78.54944691 33.88964566
157       -78.51078074 33.88141495
158       -77.14037951 35.60543020
159       # reproject points and generate vector map on the fly
160       m.proj -i input=waypoints.txt | v.in.ascii input=- output=test_pnts
161       # verify result
162       v.db.select test_pnts cat|dbl_1|dbl_2|dbl_3
163       1|661427.74|16329.14|0
164       2|651285.43|15586.79|0
165       3|654867.21|14690.64|0
166       4|778074.58|207402.6|0
167
168   Custom projection parameter usage
169       To transform points from a UTM projection (here specified with detailed
170       projection  definition  rather  than  using  an  EPSG  code)  into  the
171       Gauss-Krüger Grid System, importing from and exporting to files:
172       m.proj proj_in="+proj=utm +name=utm +a=6378137.0 +es=0.006694380 \
173           +zone=32 +unfact=1.0" proj_out="+proj=tmerc +name=tmerc \
174           +a=6377397.155 +es=0.0066743720 +lat_0=0.0 +lon_0=9.0 +k=1.0 \
175           +x_0=3500000.0" input=utm.coord.txt output=new.gk.coord.txt
176
177       Projection  parameters  provided  in  the above case: +proj (projection
178       type), +name (projection name), +a (ellipsoid: equatorial radius),  +es
179       (ellipsoid:  eccentricity  squared), +zone (zone for the area), +unfact
180       (conversion factor from meters  to  other  units,  e.g.  feet),  +lat_0
181       (standard  parallel),  +lon_0 (central meridian), +k (scale factor) and
182       +x_0 (false easting). Sometimes false northing is needed which is coded
183       as  +y_0.   Internally, the underlying PROJ projection library performs
184       an inverse projection to latitude-longitude and then projects the coor‐
185       dinate list to the target projection.
186
187       Datum  conversions  are  automatically  handled  by the PROJ library if
188       +datum setings are specified on both the input and  output  projections
189       on  the  command  line.  The  +towgs84  parameter can be used to define
190       either 3 or  7  term  datum  transform  coefficients,  satisfying  this
191       requirement.
192
193       If  a datum is specified there is no need for the +ellps= or underlying
194       parameters, +a=, +es=, etc.
195
196       Another custom parameter usage example:
197       m.proj proj_in="+proj=tmerc +datum=ire65 +lat_0=53.5 +lon_0=-8 +x_0=200000 \
198           +y_0=250000 +k=1.000035" proj_out="+proj=ll +datum=wgs84" input=wpt.txt
199       or without datum transformation:
200       m.proj proj_in="+proj=tmerc +ellps=modif_airy +lat_0=53.5 +lon_0=-8 +x_0=200000 \
201           +y_0=250000 +k=1.000035" proj_out="+proj=ll +datum=wgs84" input=wpt.txt
202
203       In this example no datum transformation will take place as a datum  was
204       not  specified  for  the  input projection. The datum specified for the
205       output projection will thus be silently ignored and may  be  left  out;
206       all  that  is  achieved  a simple conversion from projected to geodetic
207       co-ordinates, keeping the same datum (and thus  also  the  same  ellip‐
208       soid).
209
210       For  more usage examples, see the documentation for the PROJ cs2cs pro‐
211       gram.
212

REFERENCES

214           ·   Evenden, G.I.  (1990) Cartographic  projection  procedures  for
215               the  UNIX environment - a user’s manual.  USGS Open-File Report
216               90-284 (OF90-284.pdf) See also there: Interim  Report  and  2nd
217               Interim Report on Release 4, Evenden 1994).
218
219           ·   PROJ Cartographic Projection Library
220

SEE ALSO

222        g.proj, r.proj, v.proj, i.rectify, v.in.ascii, v.out.ascii
223

AUTHOR

225       M. Hamish Bowman, Dept. Marine Science, Otago University, New Zealand
226       Functionality  inspired by the m.proj and m.proj2 modules for GRASS GIS
227       5.
228

SOURCE CODE

230       Available at: m.proj source code (history)
231
232       Main index | Miscellaneous index | Topics  index  |  Keywords  index  |
233       Graphical index | Full index
234
235       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
236
237
238
239GRASS 7.8.5                                                          m.proj(1)
Impressum