GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GRASS and the PROJ4 projection library

by GRASS Development Team

http://grass.osgeo.org

GRASS and the PROJ4 projection library

GRASS utilizes the PROJ4 library (http://proj.osgeo.org) originally developed by Gerald Evenden/USGS (Cartographic Projection Procedures for the UNIX Environment – A User's Manual, Evenden, 1990, Open-file report 90-284). The PROJ4 functions are used through wrapper functions in a GRASS environment.

Internally to the PROJ.4 library, projection may involve transformation to and from geodetic co-ordinates (latitude and longitude), and numerical corrections to account for different datums.

This is transparent for the user as input and output parameters are either read from PROJ_INFO and PROJ_UNITS files (g.proj, v.proj, r.proj) or read from user prompts (g.proj and g.setproj).

In GRASS the wrapper functions in lib/proj/get_proj.c makes the preparations to set up the parameter strings and init the info-structures, while lib/proj/do_proj.c contains the actual projection calls.

Files lib/proj/ellipse.c and lib/proj/datum.c contain functions for querying GRASS locations and users for ellipsoid and datum information (some of these functions were included in the GIS library in earlier versions of GRASS).

File lib/proj/convert.c contains functions for converting GRASS co-ordinate system descriptions to and from the formats used by other GIS. Heavy use is made of the OGR library, part of GDAL (http://www.gdal.osgeo.org/ogr/).

Datum transformation

GRASS generally supports datum transformation (3 parameters, 7 parameters and grid).

If a warning appears that a certain datum is not recognised by GRASS and no parameters found, the datum transformation parameters have to be added to $GISBASE/etc/datum.table (and also $GISBASE/etc/datumtransform.table if you have 7-parameter transformation parameters). No need to re-compile though. When adding to SVN, currently these files are still in lib/gis/.

Makefile Example

The following code demonstrates the Makefile.

MODULE_TOPDIR = ../..

PGM = r.myproj

EXTRA_INC = $(PROJINC)
LIBES     = $(GPROJLIB) $(GISLIB)
DEPENDENCIES= $(GPROJDEP) $(GISDEP)

include $(MODULE_TOPDIR)/include/Make/Module.make

default: cmd

Function