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.

No comments: