g.proj(1)
β¨ g.proj(1) β¨ β the GRASS GIS User's Manual, but make it a group chat
okay so bestie, welcome to the g.proj(1) page from the GRASS GIS User's Manual π this is the one that handles projection info files. it's long. it's iconic. let's go π«Ά
πΈ NAME πΈ
g.proj β prints or modifies GRASS projection information files (in various co-ordinate system descriptions). it can also be used to create new GRASS projects. yes bestie, both. multitalented. π
π KEYWORDS π
general, projection, create project
π SYNOPSIS π
g.proj
g.proj --help
g.proj [-pgdjfwetc] [georef=file] [wkt=file] [srid=params]
[proj4=params] [epsg=code] [list_codes=string] [datum=name]
[datum_trans=index] [project=name] [--help] [--verbose] [--quiet]
[--ui]
π Flags π
-pβ print the projection info in the classic conventional GRASS format-gβ print the projection info in shell script style (yes, so you can just source it, iykyk)-dβ verify the datum info and print out the transformation parameters-jβ print the projection info in PROJ.4 format-fβ "flat" output, no linebreaks (only applies to WKT and PROJ.4 output, just so u know)-wβ print the projection info in WKT format-eβ use ESRI-style format (WKT output only, bestie)-tβ force an override of the datum transformation info in the input co-ordinate system-cβ modify the current project's projection files--helpβ print the usage summary--verboseβ verbose module output--quietβ quiet module output--uiβ force launching the GUI dialog
π¦ Parameters π¦
georef=fileβ name of a georeferenced data file to read projection info fromwkt=fileβ name of an ASCII file containing a WKT projection description;-means standard inputsrid=paramsβ spatial reference ID with authority name and code. e.g.EPSG:4326orurn:ogc:def:crs:EPSG::4326proj4=paramsβ PROJ.4 projection description;-means standard inputepsg=codeβ EPSG projection code. Options:1-1000000list_codes=stringβ list codes for a given authority, e.g. EPSG, then exit. Options:EPSG,ESRI,IAU_2015,IGNF,NKG,NRCAN,OGC,PROJdatum=nameβ datum (overrides any datum specified in the input co-ordinate system). accepts standard GRASS datum codes, or"list"to list them all and exitdatum_trans=indexβ index number of datum transform parameters."0"for unspecified, or"-1"to list and exit. Options:-1-100. Default:0project=nameβ name of the new project (location) to create
π DESCRIPTION π
g.proj is your girl for converting a coordinate reference system (CRS) description between all the various formats. glow-up for your projection data, fr fr. β¨
if you want an actual introduction to map projections (with PROJ), go read the manual page of r.proj. this one assumes you're here to do the thing, not to get the lore.
so β if it was compiled without OGR present, the functionality is limited to:
- reporting the CRS information for the current project (which used to be called a location, for the elders in the chat), either in conventional GRASS (
-pflag) or PROJ (-jflag) format - changing the datum, or reporting and modifying the datum transformation parameters, for the current project
when it's compiled with OGR, the functionality levels up π₯ and it can also output the CRS information in the Well-Known Text (WKT) format β the one made famous by proprietary GIS. and on top of that, if you specify one of the parameters georef, wkt, proj4 or epsg, then instead of reading from the current project, the CRS info gets imported from an external source, like this:
georef=filename g.proj tries to invoke GDAL and then OGR in turn to read a georeferenced file filename. the CRS info gets read from that file. if the file isn't georeferenced or just can't be read, XY (unprojected) will be used.
wkt=filename or - the file filename should contain a CRS description in WKT format, with or without line-breaks (like a .prj file, bestie). if you pass - as the filename, the WKT description gets read from stdin instead of from a file.
proj4=description or - description should be a CRS description in PROJ format, and it needs to be wrapped in quotation marks if there are any spaces in it. if you pass - for description, the PROJ description gets read from stdin instead of being supplied directly as a command-line parameter.
epsg=number number should match the index number of a valid co-ordinate system in the EPSG database. EPSG code support runs off a local copy of the GDAL CSV co-ordinate system and datum information files, stored in the directory $GISBASE/etc/proj/ogr_csv. those can be updated if needed, so that future revisions of the EPSG database are supported too. π«
if the datum information is incorrect or missing in the input co-ordinate system definition (and ngl, PROJ descriptions have very limited support for specifying datum names), you can supply a GRASS datum abbreviation instead using the datum parameter. this overrides any datum contained in the input co-ordinate system, and it discards any datum transformation parameters β like, gone. enter datum=list to get a list of all the datums GRASS supports. and since any existing datum transformation parameters will have been discarded, the datumtrans parameter should in general always be used alongside datum. no cap.
the -p, -j, -w, etc. flags all still work when you're importing CRS info from an external source, which means g.proj can be used to convert between representations of the info. it is not required that either the input or the output be in GRASS format. we're flexible like that. π
but wait β there's more. if the -c flag is specified, g.proj will create new GRASS CRS files (PROJ_INFO, PROJ_UNITS, WIND and DEFAULT_WIND) based on the imported info. and if the project parameter is specified in addition to -c, then a whole new project gets created. otherwise, the CRS information files in the current project get overwritten.
β οΈ bestie. listen. the program will NOT warn you before doing this. no "are you sure?", no "undo?", nothing. she just does it. π
the final mode of operation of g.proj is to report on the datum info and the datum transformation parameters associated with the co-ordinate system. the -d flag will report a human-readable summary of all that. cute and informative. π
π§ NOTES π§
if the input co-ordinate system contains a datum name but no transformation parameters, and there's more than one suitable parameter set available (according to the files datum.table and datumtransform.table in $GISBASE/etc/proj), then g.proj will check the value of the datumtrans option and act like this:
-1: list the available parameter sets in a GUI-parsable (but also human-readable) format, and exit.0(default): continue without specifying parameters β and if you use this while creating a project, other GRASS modules will use the "default" (likely non-optimum) parameters for this datum if they ever need to in the future. just so you know what you're signing up for.- any other number that's less than or equal to the number of parameter sets available for this datum: choose that parameter set and add it to the co-ordinate system description.
if the -t flag is specified, the module will attempt to change the datum transformation parameters using one of the above two methods β even if a valid parameter set is already specified in the input co-ordinate system. this is actually super useful for changing the datum information on an existing project. π₯
output is simply based on the input CRS information. g.proj does not attempt to verify that the co-ordinate system described actually matches some existing system in use out there in the world. in particular, this means there are no EPSG Authority codes in the WKT output. she is not a fact-checker, she is a converter. periodt.
WKT format shows the false eastings and northings in the projected unit (e.g. meters, feet) β but in PROJ format, it should always be given in meters. don't mix that up. π
the maximum size of input WKT or PROJ CRS descriptions is limited to 8000 bytes.
π EXAMPLES π
π Print information π
print the CRS information for the current project:
g.proj -p
list the possible datum transformation parameters for the current project:
g.proj -t datumtrans=-1
π Create projection (PRJ) file π
create a .prj file in ESRI format corresponding to the current project:
g.proj -wef > irish_grid.prj
π Read CRS from file π
read the CRS information from a GeoTIFF file and print it in PROJ format:
g.proj -jf georef=ASTER_DEM20020508161837.tif
convert the PROJ CRS description contained in a text file to WKT format:
cat proj4.description | g.proj -w proj4=-
π Create new project π
create a new project with the coordinate system referred to by EPSG code 4326 (Latitude-Longitude/WGS84), without explicitly specifying datum transformation parameters:
g.proj -c epsg=4326 project=latlong
create a new project with the coordinate system referred to by EPSG code 3857 (Pseudo-Mercator Projection):
g.proj -c epsg=3857 project=google
create a new project with the coordinate system referred to by EPSG code 29900 (Irish Grid), selecting datum transformation parameter set no. 2:
# list available datums for EPSG code 29900
g.proj -t datumtrans=-1 epsg=29900
g.proj -c epsg=29900 datumtrans=2 project=irish_grid
create a new project with the same coordinate system as the current project, but forcing a change to datum transformation parameter set no. 1:
g.proj -c project=newloc -t datumtrans=1
create a new project with the coordinate system from a WKT definition stored in a text file:
g.proj -c wkt=irish_grid.prj project=irish_grid
create a new project from a PROJ description, explicitly specifying a datum and using the default datum transformation parameters:
g.proj -c project=spain proj4="+proj=utm +zone=30 +ellps=intl" datum=eur50 datumtrans=0
π Using g.proj output for GDAL/OGR tools π
reproject an external raster map to the current GRASS project (does not always make sense! π) using the GDAL gdalwarp tool. we recommend using the ERDAS/Img format, and not using the ESRI style of WKT:
# example for 30x30 pixel resolution (enforce with -tr to avoid odd values)
gdalwarp -of HFA -tr 30 30 -t_srs "`g.proj -wf`" aster.img aster_tmerc.img
reproject an external vector map to the current GRASS project using the OGR ogr2ogr tool:
ogr2ogr -t_srs "`g.proj -wf`" polbnda_italy_GB_ovest.shp polbnda_italy_LL.shp
π REFERENCES π
- PROJ: Projection/datum support library
- GDAL raster library and toolset
- OGR vector library and toolset
Further reading
- ASPRS Grids and Datum
- MapRef - The Collection of Map Projections and Reference Systems for Europe
- Projections Transform List (PROJ)
π SEE ALSO π
m.proj, r.proj, v.proj, r.import, r.in.gdal, v.import, v.in.ogr
π AUTHOR π
Paul Kelly
πΎ SOURCE CODE πΎ
okay bestie, you wanna see the actual code? the source of the source? obsessed. π
- Available at:
g.proj source code(history) - Accessed:
Saturday Jan 17 05:40:40 2026
and if you're in your little rabbit-hole era πβ¨ and wanna click around the whole manual, here's the full navigation menu, every single link, no skips:
Main indexGeneral indexTopics indexKeywords indexGraphical indexFull index
like, go explore fr fr. it's giving "research era" and we love that for you π
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's the whole page, bestie!! π you just read the entire g.proj manual like the absolute icon you are π this was GRASS GIS 8.4.2, accessed on that very specific Saturday Jan 17 05:40:40 2026 moment, and every bit of it belongs to the GRASS Development Team, Β© 2003-2025 π go touch some grass (literally, it's a GIS thing, iykyk) π¦β¨
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· 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