GDAL / OGR & Proj.4 Libraries and Utilities

The technologies that we will discuss today are programming libraries and utility programs that have been built upon those libraries. In particular, we will discuss three libraries: • GDAL - the Geospatial Data Abstraction Library • Currently supports up to 57 raster formats for reading and/or writing. (http://www.gdal.org/formats_list.html) Released with 11 utility programs. (http://www.gdal.org/ • gdal_utilities.html) • OGR • Currently supports 23 vector formats for reading and/ or writing. (http://www.gdal.org/ogr/ogr_formats.html) Released with 3 utility programs. (http://www.gdal.org/ogr/ • ogr_utilities.html)

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 2 Libraries and Utilities (cont.)

Proj.4 Cartographic Projections Library • > 123 supported projections • Released with three utilities. (http://proj.maptools.org/)

GDAL and OGR provide the basis for data read/write capabilities to the Open Source applications that we are using in this class, while also supporting useful functionality through the utilities that are released with them.

Similarly, Proj.4 is the foundation projection library for coordinate conversion within all of the geospatial applications used in this course.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 3 GDAL

The development of both GDAL and OGR is led by Frank Warmerdam, with the number and types of data supported by these libraries increasing with each new release.

While the specific file formats supported by GDAL and OGR depend upon which supporting libraries are used when the libraries are built, as many as 57 raster formats are currently supported by GDAL.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 4 GDAL - Formats

The current list of GDAL’s supported raster formats may be obtained from the GDAL website (http://www.gdal.org/ formats_list.html), while the formats supported by a specific installation of GDAL may be obtained by executing the gdalinfo command with the optional --formats parameter. > gdalinfo --formats Supported Formats: VRT (rw+): Virtual Raster GTiff (rw+): GeoTIFF NITF (rw+): National Imagery Transmission Format HFA (rw+): Erdas Imagine Images (.img) . . . USGSDEM (rw): USGS Optional ASCII DEM (and CDED) GXF (ro): GeoSoft Grid Exchange Format GRASS (ro): GRASS Database Rasters (5.7+)

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 5 GDAL - Utilities

gdalinfo is only one of 11 utility programs • gdalinfo - report information about a file. • gdal_translate - Copy a raster file, with control of output format. • gdaladdo - Add overviews to a file. • gdalwarp - Warp an image into a new coordinate system. • gdaltindex - Build a MapServer raster tileindex. • gdal_contour - Contours from DEM. • gdal_rasterize - Rasterize vectors into raster file. • gdal-config - Get options required to build software using GDAL. Two of which we will demonstrate here, several of which we will briefly cover later in the class.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 6 GDAL - Utilities (cont.)

In addition to the compiled programs distributed with GDAL, three utility python scripts are also provided as part of the package: • rgb2pct.py - Convert a 24bit RGB image to 8bit paletted. • pct2rgb.py - Convert an 8bit paletted image to 24bit RGB. • gdal_merge.py - Build a quick mosaic from a set of images.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 7 GDAL - Utilities: Getting Help

Getting help with the syntax of the various GDAL utilities can be accomplished several ways: • By typing the name of the command without any additional parameters, e.g. > gdalinfo Usage: gdalinfo [--help-general] [-mm] [-nogcp] [-nomd] datasetname • Also, by accessing the ‘man’ page for the command, e.g. > man gdalinfo • Documentation for the GDAL utilities may also be reviewed on GDAL’s web site: http://www.remotesensing.org/gdal/gdal_utilities.html

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 8 GDAL - gdalinfo

gdalinfo provides detailed information about a supported raster dataset. • The syntax for the gdalinfo utility may be obtained by typing the command without any parameters. > gdalinfo Usage: gdalinfo [--help-general] [-mm] [-nogcp] [-nomd] datasetname • The parameters are as follows: - --help-general : display the general help for all GDAL utiility commands - -mm : force calculation of min/max values for each band - -nogcp, -nomd : suppress display of ground control points and metadata respectively.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 9 GDAL - gdalinfo

The additional general (generic) GDAL parameters are: - --version: report version of GDAL in use. - --formats: report all configured format drivers. - --format [format]: details of one format. - --optfile filename: expand an option file into the argument list. - --config key value: set system configuration option. - --debug [on/off/value]: set debug level. - --help-general: report detailed help on general options.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 10 GDAL - gdalinfo - general information The following commands illustrate the execution of gdalinfo to acquire general information about GDAL without reference to a specific dataset. > gdalinfo --version GDAL 1.2.6.0, released 2005/03/13 > gdalinfo --formats Supported Formats: VRT (rw+): Virtual Raster GTiff (rw+): GeoTIFF etc.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 11 GDAL - gdalinfo - general information (cont.) > gdalinfo --format GTiff Format Details: Short Name: GTiff Long Name: GeoTIFF Extension: tif Mime Type: image/tiff Help Topic: frmt_gtiff.html Supports: Create() - Create writeable dataset. Supports: CreateCopy() - Create dataset by copying another. Creation Datatypes: Byte UInt16 Int16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 12 GDAL - gdalinfo - Dataset related commands gdalinfo really becomes useful when used to query a dataset for available information about that dataset. If used to query a dataset obtained from the USGS Seamless Data Delivery system for the National Elevation Dataset (NED, http:// seamless.usgs.gov/), the following results are obtained. > gdalinfo ned_27173141 Driver: AIG/Arc/Info Binary Grid Size is 2531, 1636

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 13 GDAL - gdalinfo - Dataset related commands (cont.) > gdalinfo ned_27173141

Coordinate System is: GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980",6378137,298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9108"]], AXIS["Lat",NORTH], AXIS["Long",EAST], AUTHORITY["EPSG","4269"]]

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 14 GDAL - gdalinfo - Dataset related commands (cont.) > gdalinfo ned_27173141

Origin = (-106.983889,35.302778) Pixel Size = (0.00027778,-0.00027778) Corner Coordinates: Upper Left (-106.9838889, 35.3027778) (106d59'2.00"W, 35d18'10.00"N) Lower Left (-106.9838889, 34.8483334) (106d59'2.00"W, 34d50'54.00"N) Upper Right (-106.2808334, 35.3027778) (106d16'51.00"W, 35d18'10.00"N) Lower Right (-106.2808334, 34.8483334) (106d16'51.00"W, 34d50'54.00"N) Center (-106.6323611, 35.0755556) (106d37'56.50"W, 35d 4'32.00"N) Band 1 Block=512x4 Type=Float32, ColorInterp=Undefined Min=1482.415 Max=3253.000 NoData Value=-3.40282e+38

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 15 GDAL - gdalinfo - Dataset related commands (cont.) In summary, the following information has been provided for our dataset: • The data format : specified by the driver information • The pixel dimensions of the raster • The coordinate system of the raster, specified in OGC WKT (well-known text) • The coordinates of the origin (upper-left corner) of the raster • The pixel resolution of the raster, in the units of the raster coordinate system • The coordinates of the four corners and center point of the raster • Information (including value type, min/max values., and no- data value) about the band containing the elevation values

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 16 GDAL - gdal_translate

gdal_translate provides (in addition to the general functions previously described) the capability to convert raster datasets from one format to another. • The syntax for the gdal_translate utility may be obtained by typing the command without any parameters. > gdal_translate Usage: gdal_translate [--help-general] [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/ Float64/CInt16/CInt32/CFloat32/CFloat64}] [- not_strict] [-of format] [-b band] [-outsize xsize[%] ysize[%]] [-scale [src_min src_max [dst_min dst_max]]] ulx uly lrx lry] [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-gcp pixel line easting northing]* [-mo "META-TAG=VALUE"] * [-quiet] [-sds] [-co "NAME=VALUE"]* src_dataset dst_dataset

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 17 GDAL - gdal_translate

> gdal_translate

GDAL 1.2.6.0, released 2005/03/13 The following format drivers are configured and support output: VRT: Virtual Raster GTiff: GeoTIFF ... JPEG2000: JPEG-2000 part 1 (ISO/IEC 15444-1) FIT: FIT Image USGSDEM: USGS Optional ASCII DEM (and CDED)

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 18 GDAL - gdal_translate

The options for gdal_translate allow for the following functions • Specification of the data type for exported raster bands • Specification of the output format • Selection of band(s) for output • Rescaling to a specified x- and y-dimensions • Rescaling pixel values from the source to output raster • Subsetting - either by pixel or georeferenced coordinates • Override the output projection • Override the output bounding box coordinates • Addition of metadata to the output file • Addition of ground-control points to the output raster • Bulk conversion of multple sub-datasets

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 19 GDAL - gdal_translate - sample conversion A basic use of the gdal_translate utility is in the conversion of data for use by non-GIS uers or GIS users that don’t have tools that support the current file format in which a given dataset is available. For example, the creation of a PNG file from the elevation dataset queried in our last example.

Original dataset - displayed in PNG image generated using GRASS gdal_translate Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 20 GDAL - gdal_translate - sample conversion The conversion illustrated on the previous slide may be performed using the following command: > gdal_translate -of PNG -ot Byte -scale 1400 3300 0 255 NED_27173141 NED_27173141.png Input file size is 2531, 1636 This command includes the following parameters: • -of PNG : the output file should be PNG • -ot Byte : the output values should be 8-bit • -scale 1400 3300 0 255 : the original elevation range of 1400 to 3300 m should be scaled to 0 to 255 (the values that correspond with an 8-bit number) • NED_27173141 : the source file (Binary ArcGrid) • NED_27173141.png : the output file (8-bit PNG)

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 21 OGR

OGR is included within the GDAL package, and is installed by default when GDAL is installed. OGR, and its associated utility programs complement GDAL’s raster capabilities by providing a corresponding set of vector processing capabilities.

Though supporting fewer file formats than GDAL, OGR supports many key vector formats, including: • ESRI Personal geodatabase, shapefile, and binary coverages • PostgreSQL, MySQL, Oracle Spatial • GRASS • DXF, DWG • OpenDAP • GML • and 12 other formats

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 22 OGR - formats

As with GDAL, the formats supported by a specific installation of OGR may be viewed by executing the ogrinfo command with the --formats parameter. > ogrinfo --formats Loaded OGR Format Drivers: -> "ESRI " (read/write) -> "UK .NTF" (readonly) -> "SDTS" (readonly) -> "TIGER" (read/write) ... -> "ODBC" (read/write) -> "OGDI" (readonly) -> "PostgreSQL" (read/write) -> "MySQL" (readonly)

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 23 OGR - Utilities

ogrinfo is one of three utilities distributed as part of the OGR package. • ogrinfo - lists information about an OGR supported data source • ogr2ogr - converts simple features data between file formats • ogrtindex - creates a tileindex Two of which we will discuss here, with ogrtindex receiving mention in conjunction with the overview of MapServer at the end of the course.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 24 OGR - Utilites: Getting help

As with GDAL, OGR provides three means for obtaining information about the provided utilities. • Typing the the name of an OGR utility without any parameters will bring up the usage for that utility. > ogrinfo Usage: ogrinfo [-ro] [-q] [-where restricted_where] [-summary] [-spat xmin ymin xmax ymax] [-fid fid] [-sql statement] [-al] [-so] [--formats] datasource_name [layer [layer ...]] • The ‘man’ page for each utility contains more detailed information. > man ogrinfo • The OGR web page contains additional documentation. http://www.gdal.org/ogr/ogr_utilities.html

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 25 OGR - ogrinfo

As with its counterpart in GDAL, ogrinfo provides information about a specified dataset, vector in this case. Since there is the potential for multiple, differently named ‘layers’ within a single vector dataset, the command syntax for gdalinfo requires the dataset name, and also accepts an optional layer specification. > ogrinfo Usage: ogrinfo [-ro] [-q] [-where restricted_where] [-summary] [-spat xmin ymin xmax ymax] [-fid fid] [-sql statement] [-al] [-so] [--formats] datasource_name [layer [layer ...]]

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 26 OGR - ogrinfo

The parameters accepted by ogrinfo are as follows: • -ro - open the file in read-only mode • -al - list all features of all layers • -so - summary only, suppress listing of features • -q - quiet verbose mode, provides more information about a specified layer, still without features • -where - filter condition specified as an SQL where clause • -sql - return the result of a provided SQL statement • -spat - defines, and limits returned features, to a specified area of interest • -fid - filter features by the provided feature ID • --formats - list the currently supported vector formats • datasource name and layer - define the dataset and layer within that dataset to be opened.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 27 OGR - ogrinfo - querying a dataset ogrinfo may be executed without specifying a layer in order to determine the names of the layers in a dataset. Once the layer names are known, the layer specification may be added to the ogrinfo command to obtain more detailed information about a specified layer, including the actual geometries for features within that layer.

In this case we will work with a subset of the Bureau of Transportation Statistics (BTS) road coverage available through the USGS Seamless Data Download site (http:// seamless.usgs.gov/).

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 28 OGR - ogrinfo - querying a dataset The initial query provides the name of the layer for which we will seek additional information. > ogrinfo 45603876.shp INFO: Open of `45603876.shp' using driver `ESRI Shapefile' successful. 1: 45603876 (Line String) The output of this command indicates three things: • The name of the file that was opened • The driver used to open the file (the file type • The name, and type of the layer(s) in the file

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 29 OGR - ogrinfo - querying a dataset Our follow-up query adds the layer specification to the command, and results in much more information > ogrinfo -so 45603876.shp 45603876 INFO: Open of `45603876.shp' using driver `ESRI Shapefile' successful.

Layer name: 45603876 Geometry: Line String Feature Count: 67060 Extent: (-107.441270, 34.417818) - (-105.774860, 35.771054)

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 30 OGR - ogrinfo - querying a dataset

> ogrinfo -so 45603876.shp 45603876 Layer SRS WKT: GEOGCS["GCS_North_American_1983", DATUM["North_American_Datum_1983", SPHEROID["GRS_1980", 6378137.0,298.257222101]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]]

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 31 OGR - ogrinfo - querying a dataset

> ogrinfo -so 45603876.shp 45603876 FNODE_: Integer (10.0) TNODE_: Integer (10.0) LPOLY_: Integer (10.0) RPOLY_: Integer (10.0) LENGTH: Real (19.8) BDT_ROADS6: Integer (10.0) BDT_ROADS_: Integer (10.0) PREFIX: String (2.0) NAME: String (30.0) TYPE: String (4.0) SUFFIX: String (2.0) FCC: String (3.0) FIPS: String (11.0)

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 32 OGR - ogrinfo - querying a dataset The preceding dataset query returned useful information about the specified dataset and layer, including: • The name of the queried vector file • The file type (driver used) • The name of the layer within the dataset that was queried • The geometry type of the queried layer • The spatial extent of the layer • The Spatial Reference System (SRS) of the dataset • A listing of all of the attributes associated with the layer, and their data types This was just a summary query. If a query was made that did not limit the returned information to the available summary, detailed information about each feature, including the coordinates associated with the geometry of that feature would also be provided. This can result in massive volumes of output for most datasets.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 33 OGR - ogr2ogr

As with gdal_translate in GDAL, ogr2ogr provides for format conversion for the specified dataset, vector in this case. Since there is the potential for multiple, differently named ‘layers’ within a single vector dataset, the command syntax for gdalinfo requires the source and destination dataset names, in addition to the name of the layer to be converted. > ogr2ogr Usage: ogr2ogr [-skipfailures] [-append] [- update] [-f format_name] [-select field_list] [- where restricted_where] [-spat xmin ymin xmax ymax] [-preserve_fid] [-fid FID] [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def] [[-dsco NAME=VALUE] ...] dst_datasource_name src_datasource_name [-lco NAME=VALUE] [-nln name] [-nlt type] layer [layer ...]]

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 34 OGR - ogr2ogr

The parameters for ogr2ogr include the following: • -f format_name: output file format name • -append: Append to existing layer instead of creating new • -update: Open existing output datasource in update mode • -select field_list: Comma-delimited list of fields from input layer to copy to the new layer (defaults to all) • -where restricted_where: Attribute query (like SQL WHERE) • -skipfailures: skip features or layers that fail to convert • -spat xmin ymin xmax ymax: spatial query extents

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 35 OGR - ogr2ogr

• -dsco NAME=VALUE: Dataset creation option (format specific) • -lco NAME=VALUE: Layer creation option (format specific) • -nln name: Assign an alternate name to the new layer • -nlt type: Force a geometry type for new layer. • -a_srs srs_def: Assign an output SRS • -t_srs srs_def: Reproject/transform to this SRS on output • -s_srs srs_def: Override source SRS

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 36 OGR - ogr2ogr

The conversion of our sample dataset from its original shapefile format to an OGC GML file format is accomplished through the following command. > ogr2ogr -f "GML" 45603876.xml 45603876.shp 45603876 with the resulting XML document providing a portable rendering of the geometry and associated attributes for the shapefile in a standards-based ASCII text format that is increasingly supported by desktop and online GIS applications as a valid vector data input format.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 37 Proj.4

Proj.4 is a programming library and associated utilities developed by Gerald Evenden, then of the USGS for performing Cartographic Projections: the conversion of coordinates specified in the spherical coordinate system (degrees Lat/Lon) of Earth into x,y coordinates in a plane.

e.g. the Miller Cylindrical Projection - from the Wikipedia: http://en.wikipedia.org/wiki/Map_projection Proj.4 provides the basic coordinate conversion capabilities used by many Open Source applications, and also provides basic command-line utilities for performing conversion tasks.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 38 Examples of Supported Projections

Albers Equal Area Sinusoidal

Mercator Rectangular Polyconic

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 39 Proj.4 Utilities

Proj.4 is currently distributed with three command line utilities that may be used to perform basic cartographic coordinate conversion functions. • /invproj - forward and reverse cartographic projection • cs2cs - conversion between coordinate systems (geographic or projected) • geod/invgeod - direct and inverse geodesic (great circle) calculations Two of which, proj and cs2cs, we will look at examples of.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 40 Proj.4 Utilities - proj

The proj utility is a simple command line program that may be used to convert from geographic coordinates (i.e. degrees lat/ lon) to projected coordinates and vice-versa. As with previous commands, there are several ways to obtain help in the use of proj. • By typing in the command without any parameters > proj Rel. 4.4.9, 29 Oct 2004 usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ] • By requesting to see the ‘man’ page for the program > man proj • Or, by reading the PDF documentation for the program. Available through the Proj.4 website: http://proj.maptools.org/

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 41 Proj.4 Utilities - Projection Parameters

Key to working productively with proj, the other Proj.4 utilities, and many of the applications that use Proj.4’s reprojection libraries is knowing how to define the Proj.4 projection parameters associated with a given projection. These parameters provide the specifications required for the (often complex) mathematical calculations that are required to convert from one coordinate system to another.

The Proj.4 parameters associated with a given projection are documented in the Proj.4 documentation related to a given projection, and may also be accessed through the proj -lP command.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 42 Proj.4 Utilities - Projection Parameters

> proj -lP aea : Albers Equal Area Conic Sph&Ell lat_1= lat_2= aeqd : Azimuthal Equidistant Azi, Sph&Ell lat_0 guam ... wink2 : Winkel II PCyl., Sph., no inv. lat_1= wintri : Winkel Tripel Misc Sph lat_1 The highlighted values in the listing correspond to the name associated with the +proj parameter (e.g. +proj=aea, +proj=wink2). This parameter is required for all conversions.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 43 Proj.4 Utilities - Projection Parameters

> proj -lP aea : Albers Equal Area Conic Sph&Ell lat_1= lat_2= aeqd : Azimuthal Equidistant Azi, Sph&Ell lat_0 guam ... wink2 : Winkel II PCyl., Sph., no inv. lat_1= wintri : Winkel Tripel Misc Sph lat_1 The highlighted values in the listing correspond with descriptive information for each supported projection: the name, the type of projection, and whether inverse projections are supported.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 44 Proj.4 Utilities - Projection Parameters

> proj -lP aea : Albers Equal Area Conic Sph&Ell lat_1= lat_2= aeqd : Azimuthal Equidistant Azi, Sph&Ell lat_0 guam ... wink2 : Winkel II PCyl., Sph., no inv. lat_1= wintri : Winkel Tripel Misc Sph lat_1 The highlighted values in the listing correspond to the additional projection parameters associated with the projection. Is some cases these parameters will take default values if the additional parameters are not provided.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 45 Proj.4 Utilities - Projection Parameters

In addition to projection-specific parameters, there are also parameters associated with the definition of the shape of the Earth and the horizontal datum associated with a given coordinate system. The available elipsoids may be obtained through the proj -le command while the available datums may be obtained through the proj -ld command.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 46 Proj.4 Utilities - Projection Parameters

> proj -le MERIT a=6378137.0 rf=298.257 MERIT 1983 SGS85 a=6378136.0 rf=298.257 Soviet Geodetic System 85 GRS80 a=6378137.0 rf=298.257222101 GRS 1980(IUGG, 1980) ... The values provided as the output of this command consist of the short name used to refer to the elipsoid in commands, the shape parameters associated with a specific named elipsoid, and the long name of the elipsoid. The shape parameters are the same as those that you would manually define if you need to define an elipsoid that does not already have a named definition within Proj.4.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 47 Proj.4 Utilities - Projection Parameters

> proj -ld __datum_id__ __ellipse___ __definition/comments______WGS84 WGS84 towgs84=0,0,0 GGRS87 GRS80 towgs84=-199.87,74.79,246.62 Greek_Geodetic_Reference_System_1987 NAD83 GRS80 towgs84=0,0,0 North_American_Datum_1983 ... The values provided as the output of this command consist of the short name used to refer to the datum in commands (+datum=), the name of the elipsoid associated with the datum, the parameters associated with the datum’s relationship with the WGS84 elipsoid, and the full name of the datum. The towgs84 parameter is the same as that you would manually define if you need to define an datum that does not already have a named definition within Proj.4.

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 48 Proj.4 Utilities - proj -example

An illustration of the use of proj is provided by the conversion of the latitude and longitude of Albuquerque to the corresponding values in UTM Zone 13 (NAD83). The source coordinates are derived from GNIS, and are converted using proj. Latitude: 35°05′04″N Longitude: 106°39′04″W Forward Projection > proj +proj=utm +zone=13 << EOF > -106.65111 35.08444 > 106d39'04"W 35d05'04" > EOF 349481.29 3883653.98 349481.20 3883654.48

Inverse Projection > proj -I +proj=utm +zone=13 << EOF > 349481.29 3883653.98 > EOF 106d39'3.996"W 35d5'3.984"N

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 49 Proj.4 Utilities - cs2cs

The cs2cs utility is a simple command line program that may be used to convert from one coordinate system to another (projected or geographic). As with previous commands, there are several ways to obtain help in the use of cs2cs. • By typing in the command without any parameters > cs2cs Rel. 4.4.9, 29 Oct 2004 usage: cs2cs [ -eEfIlrstvwW [args] ] [ +opts [=arg] ] [+to [+opts[=arg] [ files ] • By requesting to see the ‘man’ page for the program > man cs2cs • Or, by reading the PDF documentation for the program. Available through the Proj.4 website: http://proj.maptools.org/

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 50 Proj.4 Utilities - cs2cs -example

An illustration of the use of cs2cs is provided by the conversion of the latitude and longitude of Albuquerque to the corresponding values in UTM Zone 13 (NAD83), with those values then being converted to the corresponding coordinates in Lambert Eqal Area Conic projection. Latitude: 35°05′04″N, Longitude: 106°39′04″W Forward Projection > cs2cs +proj=latlong +to +proj=utm +zone=13 << EOF > 106d39'04"W 35d05'04"N > EOF 349481.20 3883654.48 0.00

Projection from UTM Zone 13 to Lambert Equal Area Conic > cs2cs +proj=utm +zone=13 +to +proj=leac +lat_1=35.08444 << EOF > 349481.20 3883654.48 > EOF -6596992.91 9459539.72 0.00

Open Source Geographic Information Technologies - GDAL/OGR & Proj.4 51