g.proj(1grass)

g.proj(1grass) β€” manual page from the GRASS User's Manual πŸ’– bestie, this one is all about projections and it ate.

✨ NAME ✨

  • g.proj β€” Prints or modifies GRASS projection information files (in various co-ordinate system descriptions). Can also be used to create new GRASS projects. πŸ‘‘

🌸 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]  format=name  [--help]  [--verbose]
[--quiet]  [--ui]

πŸ¦‹ Flags πŸ¦‹

  • -p β€” Print projection information ✨
  • -g β€” Print projection information in shell script style [deprecated]. This flag is deprecated and will be removed in a future release. Use format=shell instead.
  • -d β€” Verify datum information and print transformation parameters πŸ”
  • -j β€” Print projection information in PROJ.4 format [deprecated]. This flag is deprecated and will be removed in a future release. Use format=proj4 instead.
  • -f β€” Print ’flat’ output with no linebreaks (applies to WKT and PROJ.4 output)
  • -w β€” Print projection information in WKT format [deprecated]. This flag is deprecated and will be removed in a future release. Use format=wkt instead.
  • -e β€” Use ESRI-style format (applies to WKT output only)
  • -t β€” Force override of datum transformation information in input co-ordinate system
  • -c β€” Modify current project’s projection files
  • --help β€” Print usage summary
  • --verbose β€” Verbose module output
  • --quiet β€” Quiet module output
  • --ui β€” Force launching GUI dialog

✨ Parameters ✨

  • georef=file β€” Name of georeferenced data file to read projection information from
  • wkt=file β€” Name of ASCII file containing a WKT projection description. ’-’ for standard input
  • srid=params β€” Spatial reference ID with authority name and code. E.g. EPSG:4326 or urn:ogc:def:crs:EPSG::4326
  • proj4=params β€” PROJ.4 projection description. ’-’ for standard input
  • epsg=code β€” EPSG projection code. Options: 1-1000000
  • list_codes=string β€” List codes for given authority, e.g. EPSG, and exit. Options: EPSG, ESRI, IAU_2015, IGNF, NKG, NRCAN, OGC, PROJ
  • datum=name β€” Datum (overrides any datum specified in input co-ordinate system). Accepts standard GRASS datum codes, or "list" to list and exit
  • datum_trans=index β€” Index number of datum transform parameters. "0" for unspecified or "-1" to list and exit. Options: -1-100. Default: 0
  • project=name β€” Name of new project (location) to create
  • format=name [required] β€” Output format. Options: plain, shell, wkt, projjson, proj4. Default: plain
    • plain: Human readable text output
    • shell: shell script style text output
    • wkt: Well-known text output
    • projjson: JSON (JavaScript Object Notation) version of WKT
    • proj4: PROJ.4 style text output

πŸ’– DESCRIPTION πŸ’–

g.proj provides a means of converting a coordinate reference system (CRS) description between various formats. It’s giving translator bestie for CRS data 🌈

For an introduction to map projections (with PROJ), see the manual page of r.proj.

If compiled without OGR present, the functionality is limited to:

  • Reporting the CRS information for the current project (previously called location), either in conventional GRASS (-p flag) or PROJ (-j flag) format
  • Changing the datum, or reporting and modifying the datum transformation parameters, for the current project

When compiled with OGR, functionality is increased and allows output of the CRS information in the Well-Known Text (WKT) format popularised by PROJ and GDAL. In addition, if one of the parameters georef, wkt, proj4 or epsg is specified, rather than being read from the current project, the CRS information is imported from an external source as follows:

  • georef=filename β€” g.proj attempts to invoke GDAL and OGR in turn to read a georeferenced file filename. The CRS information will be read from this file. If the file is not georeferenced or cannot 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 (e.g. a ’.prj’ file). If - is given for the filename, the WKT description will be read from stdin rather than a file.
  • proj4=description or - β€” description should be a CRS description in PROJ format, enclosed in quotation marks if there are any spaces. If - is given for description, the PROJ description will be read from stdin rather than as a directly-supplied command-line parameter.
  • epsg=number β€” number should correspond to the index number of a valid co-ordinate system in the EPSG database. EPSG code support is based upon a local copy of the GDAL CSV co-ordinate system and datum information files, stored in the directory $GISBASE/etc/proj/ogr_csv. These can be updated if necessary to support future revisions of the EPSG database.

If datum information is incorrect or missing in the input co-ordinate system definition (e.g. PROJ descriptions have very limited support for specifying datum names), a GRASS datum abbreviation can instead be supplied using the datum parameter. This will override any datum contained in the input co-ordinate system, and discard any datum transformation parameters. Enter datum=list to return a list of all the datums supported by GRASS. Since any existing datum transformation parameters will have been discarded, the datumtrans parameter should in general always be used in conjunction with datum.

The -p, -j, -w, etc. flags are all functional when importing CRS information from an external source, meaning that g.proj can be used to convert between representations of the information. It is not required that either the input or output be in GRASS format.

In addition however, 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 information. If the project parameter is specified in addition to -c, then a new project will be created. Otherwise the CRS information files in the current project will be overwritten. The program will not warn before doing this.

⚠️ bestie, fr fr, this overwrite is not a drill β€” g.proj will not warn before doing this.

The final mode of operation of g.proj is to report on the datum information and datum transformation parameters associated with the co-ordinate system. The -d flag will report a human-readable summary of this.

πŸ‘‘ NOTES πŸ‘‘

If the input co-ordinate system contains a datum name but no transformation parameters, and there is more than one suitable parameter set available (according to the files datum.table and datumtransform.table in $GISBASE/etc/proj), g.proj will check the value of the datumtrans option and act according to the following:

  • -1: List available parameter sets in a GUI-parsable (but also human-readable) format and exit.
  • 0 (default): Continue without specifying parameters - if used when creating a project, other GRASS modules will use the "default" (likely non-optimum) parameters for this datum if necessary in the future.
  • Any other number less than or equal to the number of parameter sets available for this datum: Choose this 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 can be useful to change the datum information for an existing project.

Output is simply based on the input CRS information. g.proj does not attempt to verify that the co-ordinate system thus described matches a pre-defined existing system in use in the world. In particular, this means there may be no authority names and codes in the WKT output.

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.

PROJJSON format is a JSON version of the WKT format, see the PROJJSON specification.

The maximum size of input WKT or PROJ CRS descriptions is limited to 8000 bytes. 🫢

πŸŽ€ EXAMPLES πŸŽ€

okay bestie, this is the part where it all clicks. real commands, real vibes, go off ✨


wanna see the CRS info for the project you're currently in? say less:

g.proj -p

and if you wanna list out all the possible datum transformation parameters available for the current project:

g.proj -t datumtrans=-1

🌸 Create projection (PRJ) file

making a '.prj' file in ESRI format that matches the current project? literally one line:

g.proj -wef > irish_grid.prj

πŸ¦‹ Read CRS from file

pull the CRS info out of a GeoTIFF and print it in PROJ format, no notes:

g.proj -jf georef=ASTER_DEM20020508161837.tif

and if you've got a PROJ CRS description chillin' in a text file and you wanna convert it to WKT format, pipe it in like this:

cat proj4.description | g.proj -w proj4=-

πŸ‘‘ Create new project

new project using the coordinate system from EPSG code 4326 (that's Latitude-Longitude/WGS84), without you having to spell out datum transformation parameters:

g.proj -c epsg=4326 project=latlong

new project with the coordinate system from EPSG code 3857 (Pseudo-Mercator Projection):

g.proj -c epsg=3857 project=google

new project with the coordinate system from EPSG code 29900 (Irish Grid), and this time we're picking 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

new project with the exact same coordinate system as the current project, but forcing a switch to datum transformation parameter set no. 1:

g.proj -c project=newloc -t datumtrans=1

new project built from a WKT definition you've got saved in a text file:

g.proj -c wkt=irish_grid.prj project=irish_grid

new project from a PROJ description, where you explicitly name a datum and just roll with 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 into the current GRASS project (heads up: this does not always make sense!) using the GDAL 'gdalwarp' tool. We recommend using the ERDAS/Img format, and we do not recommend 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 into 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 🧚

Available at: g.proj source code (history)

Latest change: Monday Dec 08 21:47:55 2025 in commit: d3c6479bef77a58e3b5d85259303dbfb9c1babe8

Main index | General 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 🫢 this was GRASS 8.5.0 talkin' about g.proj(1grass), last touched Monday Dec 08 21:47:55 2025 β€” go forth and reproject responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from