wiki:UserDocs/GdalTranslate

Version 2 (modified by maphew, 17 years ago) ( diff )

added Syntax for PROJ4 section

The gdal_translate utility

The official documentation for the gdal_translate utility is http://www.gdal.org/gdal_translate.html.

When to use -a_ullr

Assign/override the georeferenced bounds of the output file.

Use the -a_ullr option to add coordinates and pixel size to your raster. Using -a_srs alone only adds information about coordinate system without modifying the coordinates themselves ( i.e. upper-left coordinates, pixel size and so on). So if the source image doesn't provide this information to gdal they need to be added by hand.

Syntax for PROJ.4 parameters

In trying to use the gdal_translate on a non-standard projection, the hardest part is often to determine what the allowable syntax and meaning of the PROJ.4 parameters were (i.e. +lat_0=70, +ellps=WGS84) as an argument to -a_srs, -t_srs, -s_srs. There is no clean ready made list, however the GeoTIFF projections transform list is a great start. Find the page for the projection you need and scan for the PROJ.4 Organization heading.

For example this Arcinfo projection:

Projection    ALBERS
Datum         NAD83
Zunits        NO
Units         METERS
Spheroid      GRS1980
Xshift        0.0000000000
Yshift        0.0000000000
Parameters
61 40  0.000 /* 1st standard parallel
68  0  0.000 /* 2nd standard parallel
-132 30  0.000 /* central meridian
59  0  0.000 /* latitude of projection's origin
500000.00000 /* false easting (meters)
500000.00000 /* false northing (meters)

Becomes this in PROJ4 *:

+proj=aea +lat_1=61.66666666666666 +lat_2=68.0 +lat_0=59.0 +lon_0=-132.5 
+x_0=500000 +y_0=500000 +ellps=GRS80 +datum=NAD83 +units=m

If it is a projection you use a lot, write it to a text file and refer to it like this:

gdal_translate ... -t_srs z:\common\yt-albers.proj4 ... infile.tif outfile.tif

Note: See TracWiki for help on using the wiki.