man g.proj () - Prints and manipulates GRASS projection information files.
NAME
g.proj - Prints and manipulates GRASS projection information files.
SYNOPSIS
g.proj
g.proj help
g.proj [-pdjwefc] [georef=string] [wkt=string] [proj4=string] [location=string]
Flags:
- "-p
- Print projection information (in conventional GRASS format)
- "-d
- Verify datum information and print transformation parameters
- "-j
- Print projection information in PROJ.4 format
- "-w
- Print projection information in WKT format
- "-e
- Use ESRI-style format (applies to WKT output only)
- "-f
- Print 'flat' output with no linebreaks (applies to WKT and PROJ.4 output)
- "-c
- Create new projection files (modifies current location unless 'location' option specified)
Parameters:
- "georef=string
- Georeferenced data file to read projection information from
- "wkt=string
- ASCII file containing a single line WKT projection description (- for stdin)
- "proj4=string
- PROJ.4 projection description (- for stdin)
- "location=string
- Name of new location to create
DESCRIPTION
g.proj provides a means of manipulating GRASS projection information files. If compiled without OGR present, the functionality is limited to reporting the projection information for the current location, either in conventional GRASS (-p flag) or PROJ.4 (-j flag) format, and verifying the datum transformation information in the location (-d flag).
When compiled with OGR, functionality is increased and allows output of the projection information in the Well-Known Text (WKT) format popularised by proprietary GIS.
If one of the parameters georef, wkt or proj4 is specified, rather than the projection information being read from the current location it 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 projection 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 projection description in WKT format with no 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 projection description in PROJ.4 format, enclosed in quotation marks if there are any spaces. If - is given for description, the PROJ.4 description will be read from stdin rather than as a directly-supplied command-line parameter.
The -p, -j, -w, etc. flags are all functional when importing projection information from an external source, meaning that g.proj can be used to convert between representations of the information.
In addition, if the -c flag is specified, g.proj will create new GRASS projection files (PROJ_INFO, PROJ_UNITS, WIND and DEFAULT_WIND) based on the imported information. If the location parameter is specified in addition to -c, then a new location will be created. Otherwise the projection information files in the current location will be overwritten. The program will warn before doing this.
If compiled without OGR, the -c flag and location parameter will still be operational. However, since projection information cannot be read from an external source in this case, their use will be limited to creating a new location with the same co-ordinate system as the current one (or overwriting the projection files in the current location with identical copies).
NOTES
GRASS uses a local copy of the GDAL CSV co-ordinate system and datum information files, stored in the directory $(GISBASE)/etc/ogr_csv . This allows many possible ways of initializing a co-ordinate system, such as EPSG codes etc.
EXAMPLES
Print the projection information for the current location:
g.proj -p
Create a '.prj' file in ESRI format corresponding to the current location:
g.proj -wef > irish_grid.prj
Read the projection information from a geotiff file and print it in PROJ.4
format:
g.proj -jf georef=ASTER_DEM20020508161837.tif
Convert the PROJ.4 projection description contained in a text file to WKT
format:
cat proj4.description | g.proj -w proj4=-
Create a new location with the co-ordinate system referred to by EPSG code
4326 (Latitude-Longitude/WGS84):
g.proj -c proj4='+init=epsg:4326' location=latlong
Create a new location with the co-ordinate system referred to by EPSG code
29900 (Irish Grid):
g.proj -c proj4='+init=epsg:29900' location=irish_grid
Create a new location with the same co-ordinate system as the current
location:
g.proj -c location=newloc
Create a new location with the co-ordinate system from a WKT definition
stored in a text file:
g.proj -c wkt=irish_grid.prj location=irish_grid
Reproject external raster map to current GRASS projection (does not always make sense!)
using the GDAL 'gdalwarp' tool:
gdalwarp -t_srs "g.proj -wef" aster.tif aster_tmerc.tif
Reproject external vector map to current GRASS projection (does not always make sense!)
using the OGR 'ogr2ogr' tool:
ogr2ogr -t_srs "g.proj -wef" polbnda_italy_GB_ovest.shp polbnda_italy_LL.shp
REFERENCES
PROJ 4: Projection/datum support library
GDAL raster library and toolset
OGR vector library and toolset
SEE ALSO
g.setproj
r.in.gdal
v.in.ogr
AUTHOR
Paul Kelly
Last changed: $Date: 2005/08/18 16:04:47 $
Help Index