[Gdal-dev] Warping Plate Carree images to Mercator

Frank Warmerdam warmerdam at pobox.com
Tue Jun 6 12:40:27 EDT 2006


Robert Rose wrote:
> Hi Lennox, thanks for the response.
> 
> I'm not sure how to turn what you've given me into command line 
> parameters for gdalwarp or gdaltranslate tho...  The Mercator projection 
> string sounds pretty similar to what I was trying before...
> 
> 1) 
> Save http://veimages.gsfc.nasa.gov/7107/world.topo.bathy.200408.3x5400x2700.jpg as 
> world.jpg..
> 
> 2) gdal_translate -a_srs EPSG:32662 -gcp 0 0 -180 90 -gcp 5400 0 180 90 
> -gcp 5400 2700 180 -90 world.jpg world.tif
> 
> 3) gdalwarp -s_srs EPSG:32662 -t_srs "+proj=merc +datum=WGS84" -ts 
> 512 512 world.tif worldm.tif
> 
> (EPSG:32662 is the projection code for WGS84 Plate Carree)
> 
> So are you suggesting I add "+ellps=sphere", "es=0" and "+a=earthRadius" 
> to my gdalwarp command?

Robert,

Sorry for not responding to this before.  I think at one point you asked
what is the difference between a world Plate Caree projections (ie.
EPSG:32662) and a geographic coordinate system like EPSG:4326.

The answer is that locations in a projected coordinate system are measured
in a linear unit like meters (for EPSG:32662) while they are measured in
degrees for a geographic coordinate system like EPSG:4326.

So the problem in the above sequence is trying to assign a projected
coordinate system during the gdal_translate while using degrees for the
locations.  You need to do:

gdal_translate -a_srs EPSG:4326 -gcp 0 0 -180 90 -gcp 5400 0 180 90
  -gcp 5400 2700 180 -90 world.jpg world.tif

gdalwarp -t_srs "+proj=merc +datum=WGS84" -ts 512 512 world.tif worldm.tif

Note that I dropped the -s_srs item from the gdalwarp as well, since
the gdal_translate assignes the coordinate system to the TIFF file.

You could also use the -a_ullr commandline switch with gdal_translate
instead of using GCPs though the overall effect after the gdalwarp is not
changed.

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    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list