[gdal-dev] GDALwarp Mercator to UTMs

Frank Warmerdam warmerdam at pobox.com
Wed Aug 10 14:30:40 EDT 2011


On Wed, Aug 10, 2011 at 11:21 AM, Geoff Shipton
<geoff at tritonimaginginc.com> wrote:
> Good day, almost a complete newbie here but making progress!
>
> I have followed all the examples of GDALwarp with some success and also
> been able to use GDAL_translate to take an image with no geoferenced
> info and generate a UTM GeoTIFF (including screens from Google Earth)
>
> However my ultimate aim is to take a Mercator chart and generate a
> background image as a UTM GeoTIFF, this so far has eluded me!
>
> I have a Mercator Chart with the known corners in Lat/Long coordinates
> degrees, but I can't find a suitable EPSG/Proj4 projection that allows
> the use of Lat/Long degrees to designate -a_ullr for GDAL_translate.
> The following almost works:
>
> GDAL_translate -a_srs WGS84 -a_ullr -45 78.5 45 53.5 <source tif> <merc
> geotiff)
> then:
> GDALwarp -t_srs EPSG:32631 <merc geotiff> <UTM geotiff>

Geoff,

I believe what you need to do is transform the corner
coordinates into Mercator projection values and then
attach them to the file.

Something roughly like:

gdaltransform -s_srs WGS84 -t_srs EPSG:3857
-45 78.5
-5009377.08569731 14642047.1291333 0
45 53.5
5009377.08569731 7076025.27618058 0

gdal_translate -a_srs EPSG:3857 \
   -a_ullr -5009377 14642047 5009377 7076025 \
  source.tif merc_with_georef.tif

gdalwarp -t_srs EPSG:32631 merc_with_georef.tif utm.tif

The important thing to keep in mind is that while the
chart (or metadata) will often show the corners in WGS84
you need to specify the corners in the projected coordinate
system when assigning them to the file with gdal_translate.
The gdaltransform command can be used to reproject
locations, or you could use the PROJ.4 cs2cs command.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer


More information about the gdal-dev mailing list