Sunday, April 20, 2008

Using EPSG code in GDAL

EPSG is a code from the European Petroleum Survey Group that makes a numeric codes associated with coordinate system definitions. For example, EPSG:29193 is SAD69 / UTM zone 23S cartographic system. It's possible to browse all coordinate system definitions and codes in Spatial Reference web site.

The GDAL library in FWTools 2.1.0 allows the coordinate systems conversion from images using ESPG code.
These utilities allow the coordinate system (SRS = spatial reference system) to be assigned in a variety of formats.
  • EPSG:n: Coordinate systems (projected or geographic) can be selected based on their EPSG codes, for instance EPSG:27700 is the British National Grid. A list of EPSG coordinate systems can be found in the GDAL data files gcs.csv and pcs.csv.

In the example below is shown how to convert an image in:

GEOGCS["SAD69",DATUM["D_South_American_1969",SPHEROID
["GRS_1967_SAD69",6378160,298.25]],
PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
To:
PROJCS["SAD69 / UTM zone 24S",GEOGCS["SAD69",DATUM["D_South_American_1969",SPHEROID
["GRS_1967_SAD69",6378160,298.25]],PRIMEM["Greenwich",0],UNIT
["Degree",0.017453292519943295]],PROJECTION
["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",-39],PARAMETER
["scale_factor",0.9996],PARAMETER["false_easting",500000],
PARAMETER["false_northing",10000000],UNIT["Meter",1]]
gdal_translate -s_srs ESPG:4618 -t_srs EPSG:29194 gcs_sad.tif utm_sad.tif.

Saturday, April 5, 2008

GDAL with BIGTIFF support

The GeoTIFF format represents the effort of more than 160 companies and organizations from remote sensing market, GIS, mapping and survey data, to establish a format for interchangeable georeferenced raster files on TIFF format. With this characterirstic, the GeoTIFF format inherits a limitation on the TIFF format on producing files greater than 4 Gigabytes.

To go around this limitation, there is a new format available that allows the creation of files greater than 1 terabytes. This format is called BigTIFF. This format has the sponsorship of companies such as WeoGeo, Safe, Leica and ESRI, and it can be observed in the press release of Frank Warmerdam wich was published in Slashgeo.
FrankW writes "As announced in this press release four industry sponsors (WeoGeo, Safe, Leica and ESRI) have gotten together to fund development of BigTIFF support in libtiff. This extension adds support for GeoTIFF files much larger than 4GB! With libtiff used by most open source and commercial applications there is reason to hope that BigTIFF support will be widespread in our industry within the next year or two (sooner for open source!)." BigTIFF was previously discussed.
I can not precise when it happened but I know that the version of the library GDAL/OGR 1.4.4 of November of 2007, has already introduced the BigTIFF format support for the generation of GeoTIFF images. For those who want to work with the FWTools tool in the version 2.0.2, the BigTIFF format support through the library GDAL / OGR is already available.

The hypothetical example below shows the conversion of an image in ERDAS image format (. img), wich is greater than 4 Gigabytes, to GeoTIFF format using the FWTools shell.
gdal_translate -of GTiff -co "TFW=YES" -co "BIGTIFF=YES" "c:/temp/image.img" "c:/temp/bigtiff.tif"
The command -of defines that the output format is GeoTIFF, the command -co "TFW=YES" force the creation of a ESRI world file (.tfw) to the image generated, and, the command -co "BIGTIFF=YES" allows the generation of a TIFF file greater than 4 Gigabytes.