m.proj(1grass)
๐ m.proj โ the GRASS manual, but make it cute
okay bestie, welcome to m.proj from the GRASS User's Manual ๐ this is the one that converts coordinates from one projection to another โ it's literally a cs2cs frontend, no cap. She's little, she's powerful, she's giving main character energy โจ
KEYWORDS: miscellaneous, projection, transformation ๐ฆ
โจ SYNOPSIS โจ
m.proj
m.proj --help
m.proj [-iodec] [coordinates=east,north] [input=name] [output=name]
[separator=character] [proj_in=string] [proj_out=string]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
๐ FLAGS (the little switches, she's obsessed) ๐
-iโ use LL WGS84 as the input and your current location as the output projection. it's giving "i have lat/long, pls make it map-shaped" ๐ซถ-oโ the other way around: use your current location as input and LL WGS84 as output ๐ธ-dโ output long/lat in decimal degrees, or use it for other projections when you want many decimal places ๐ฅ-eโ include the input coordinates in the output file ๐-cโ include column names in the output file โญ--overwriteโ allow output files to overwrite existing files (chaotic, but permitted) ๐--helpโ print usage summary ๐--verboseโ verbose module output (she tells you EVERYTHING) ๐--quietโ quiet module output ๐คซ--uiโ force launching the GUI dialog โจ
๐ฆ PARAMETERS ๐ฆ
coordinates=east,northโ the input coordinates you want reprojected ๐input=nameโ name of the input coordinate file. use'-'for standard input ๐ซoutput=nameโ name for the output coordinate file (just omit it and she sends everything to<cyan>stdout</cyan>) ๐separator=characterโ field separator, formatted asinput[,output]. special characters you can use:pipe,comma,space,tab,newline. Default:pipe๐งproj_in=stringโ input projection parameters, PROJ.4 style ๐proj_out=stringโ output projection parameters, PROJ.4 style ๐
๐ DESCRIPTION ๐
okay so here's the whole vibe: this program lets you convert coordinates from one projection to another. you can read coordinates from one file, convert them, and write the results to another file. OR, if you set input=-, you can pass eastings and northings straight to the program from standard input ๐ซถ. and if you just... don't give an output option? she sends the results directly to standard output. so in that way, m.proj is basically a simple frontend to the PROJ cs2cs utility โญ. the -i or -o flags make it especially easy for the super common problem of converting to or from lat/long WGS84 โจ
Note: this program does NOT transform GRASS maps, bestie. she's designed to determine the equivalent coordinate values of an individual position or a list of positions. usev.projto reproject vector maps, orr.projfor raster maps ๐บ๏ธ
for an introduction to map projections (with PROJ), see the manual page of r.proj ๐
๐ธ NOTES (the fine print, but make it fashion) ๐ธ
cs2cs expects input data to be formatted as x y, so if you're working with latitude-longitude data, be sure to send the x value first โ i.e. longitude latitude. output data will be exported using the same convention, periodt ๐
cs2cs will treat a third data column as a z value (elevation) and will modify the value accordingly. this usually translates into small but real differences in that data column ๐ญ
cs2cs does not expect the input stream to contain column headings โ only numbers. so if your data file has lines you wish to have passed through without being processed, they must start with the '#' character ๐
if you're sending m.proj data from standard input, be aware of this: the data is first stored to a temporary file before being processed with cs2cs. so it is therefore not advisable to send m.proj data from an open data stream ๐. the module will stop listening for incoming data after 2 seconds of inactivity. in that case, you may use the projection parameters gleaned from m.proj's verbose mode (--verbose) with cs2cs directly ๐
custom projection parameters can be used via the proj_in and proj_out options ๐ ๏ธ. full documentation of the projection parameter format may be found on the PROJ website. using these options will fully override the default parameters the module would normally use ๐ฎ
by using the --verbose verbose flag, you can see exactly what projection parameters will be used in the conversion, plus some other informative messages ๐
if output is to lat/long, it will be formatted using PROJ's Degree:Minute:Second (DMS) convention of DDDdMM'SSS.SS"H. this can be handy if you wish to quickly convert lat/long decimal degree data into its DMS equivalent โจ
alternatively, to have m.proj output data in decimal degrees, use the -d flag. this flag can also be used with non-lat/long data to force a higher number of decimal places (the cs2cs default is 2) ๐ข
note that lat/long output can be converted to GRASS's DMS convention (DDD:MM:SSS.SSSH) by piping the results of m.proj through the sed stream editor as follows:
m.proj -o ... | sed -e โs/d/:/gโ -e "s/โ/:/g" -e โs/"//gโ
๐ฅ EXAMPLES ๐ฅ
the examples are suitable for the North Carolina sample dataset if not stated otherwise ๐ฒ
๐ Reproject vector point coordinate pairs to Long/Lat WGS84
the m.proj module is designed to work seamlessly with point data exported from the GIS with v.out.ascii, as the following example shows ๐ซ
# Long/Lat WGS84 output in DMS
v.out.ascii bridges | m.proj -o input=-
# Long/Lat WGS84 output in decimal degree
v.out.ascii bridges | m.proj -o -d input=-
๐ Reproject Long/Lat WGS84 coordinate pair to current map projection
to convert a Long/Lat WGS84 coordinate pair to the current map CRS using the -i flag โ which sets the target projection parameters automatically from the current project definition ๐:
echo "-78.61168178 33.92225767" | m.proj -i input=-
645513.47|19180.31|0.00
the same, but load points from a file named waypoints.txt and continue on to import the results into a GRASS vector points map in the current map projection ๐ซถ:
# check file content
cat waypoints.txt
-78.43977824 33.89587173
-78.54944691 33.88964566
-78.51078074 33.88141495
-77.14037951 35.60543020
# reproject points and generate vector map on the fly
m.proj -i input=waypoints.txt | v.in.ascii input=- output=test_pnts
# verify result
v.db.select test_pnts cat|dbl_1|dbl_2|dbl_3
1|661427.74|16329.14|0
2|651285.43|15586.79|0
3|654867.21|14690.64|0
4|778074.58|207402.6|0
๐ Custom projection parameter usage
to transform points from a UTM projection (here specified with a detailed projection definition rather than using an EPSG code) into the Gauss-Krรผger Grid System, importing from and exporting to files ๐:
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
projection parameters provided in the above case, decoded for you bestie ๐:
+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+x_0โ false easting
sometimes false northing is needed, which is coded as +y_0. internally, the underlying PROJ projection library performs an inverse projection to latitude-longitude and then projects the coordinate list to the target projection ๐
datum conversions are automatically handled by the PROJ library if +datum settings are specified on both the input and output projections on the command line. the +towgs84 parameter can be used to define either 3 or 7 term datum transform coefficients, satisfying this requirement ๐งฎ
if a datum is specified there is no need for the +ellps= or underlying parameters, +a=, +es=, etc. ๐
another custom parameter usage example:
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
or without datum transformation:
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
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 is a simple conversion from projected to geodetic co-ordinates, keeping the same datum (and thus also the same ellipsoid) ๐ซถ
for more usage examples, see the documentation for the PROJ cs2cs program ๐
โญ REFERENCES โญ
- Evenden, G.I. (1990) Cartographic projection procedures for the UNIX environment - a user's manual. USGS Open-File Report 90-284 (OF90-284.pdf) See also there: Interim Report and 2nd Interim Report on Release 4, Evenden 1994).
- PROJ Cartographic Projection Library
๐ SEE ALSO ๐
g.proj, r.proj, v.proj, i.rectify, v.in.ascii, v.out.ascii
๐ AUTHOR ๐
M. Hamish Bowman, Dept. Marine Science, Otago University, New Zealand ๐
Functionality inspired by the m.proj and m.proj2 modules for GRASS GIS 5 โจ
๐ซถ SOURCE CODE ๐ซถ
Available at: m.proj source code (history)
Latest change: Tuesday Oct 21 09:57:14 2025 in commit: fb0165c2d021b7700528aca09c224847be871729
Main index | Miscellaneous index | Topics index | Keywords index | Graphical index | Full index
ยฉ 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
and that's the whole page bestie ๐ฅน๐ m.proj(1grass) from the GRASS 8.5.0 manual, latest change Tuesday Oct 21 09:57:14 2025, ยฉ 2003-2026 GRASS Development Team. go reproject something slay ๐ โจ
๐ฆ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 ยท GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms