| g.proj(1grass) | GRASS GIS User's Manual | g.proj(1grass) |
g.proj - Prints or modifies GRASS projection
information files (in various co-ordinate system descriptions).
Can also be used to create new GRASS projects.
general, projection, create project
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]
g.proj provides a means of converting a coordinate reference system (CRS) description between various formats.
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:
When compiled with OGR, functionality is increased and allows output of the CRS information in the Well-Known Text (WKT) format popularised by proprietary GIS. 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:
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.
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.
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:
Output is simply based on the input CRS information. g.proj does not attempt to verify that the co-ordinate system thus described matches an existing system in use in the world. In particular, this means there are no EPSG Authority 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.
The maximum size of input WKT or PROJ CRS descriptions is limited to 8000 bytes.
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 a ’.prj’ file in ESRI format corresponding to
the current project:
g.proj -wef > irish_grid.prj
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 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
Reproject external raster map to current GRASS project (does not
always make sense!) using the GDAL ’gdalwarp’ tool. We
recommend to use the ERDAS/Img format and not to use 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 external vector map to current GRASS project using the
OGR ’ogr2ogr’ tool:
ogr2ogr -t_srs "`g.proj -wf`" polbnda_italy_GB_ovest.shp polbnda_italy_LL.shp
PROJ: Projection/datum support library
GDAL raster library and toolset
OGR vector library and toolset
Further reading
m.proj, r.proj, v.proj, r.import, r.in.gdal, v.import, v.in.ogr
Paul Kelly
Available at: g.proj source code (history)
Accessed: Monday Feb 24 17:50:30 2025
Main index | General index | Topics index | Keywords index | Graphical index | Full index
© 2003-2025 GRASS Development Team, GRASS GIS 8.4.1 Reference Manual
| GRASS 8.4.1 |