My goal is to download a gif file from this webpage:


Then crop it to the known latlon bounds of 75N,45S,35W,70E, convert to geotif, and then project to EPSG:4326. The map says "Mer", but how does one figure out what EPSG to use in gdal when converting to geotiff? I've tried many: 3395,3857,3785, etc, but none seem to work properly. Here are the commands I've used:

gdal_translate -of GTiff -a_srs EPSG:3857 -a_ullr -35 75 70 -45 2104_cropped.png 2104_3857.tiff

gdalwarp -s_srs EPSG:3857 -t_srs EPSG:4326 2104_3857.tiff 2104_4326.tiff

I get no warning with gdalwarp, but the image never warps, it stays the same. When i overlay them on the maps that expect EPSG:4326, the maps to don't line up.


Firstly, crop the image source (coords are expressed in pixels here) with:

gdal_translate -srcwin 115 18 1360 2156 2104.gif 2104_cropped.tif

Then, transform the known WGS84 coordinates of the upper left and lower right corners to the "WGS 84 / World Mercator" projection (EPSG:3395):

cs2cs +init=epsg:4326 +to +init=epsg:3395
-35 75
-3896182.18     12890914.14 0.00
70 -45
7792364.36      -5591295.92 0.00

Assign the "WGS 84 / World Mercator" projection and the coordinates of the upper left and lower right corners in the same SRS:

gdal_translate -a_srs EPSG:3395 -a_ullr -3896182.18 12890914.14 7792364.36 -5591295.92 2104_cropped.tif 2104_3395.tif

Finally, transform the image from the "WGS 84 / World Mercator" projection to EPSG:4326:

gdalwarp -t_srs EPSG:4326 2104_3395.tif 2104_4326.tif

This is the graphical result in gvSIG:

enter image description here


Mercator is not the same as Pseudo Mercator used by Google & Co.

Try this "real" Mercator projection:

+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
  • Thanks for the reply. Would I put all of this in place of EPSG:3857 in both commands? – user24343 Nov 25 '13 at 22:09
  • Yes, with qoutation marks around the whole string. – AndreJ Nov 26 '13 at 4:50
  • Nope. Still the same offset between the overlay and underlying EPSG:4326 layer. I'm out of ideas. Any other suggestions? – user24343 Nov 26 '13 at 7:06
  • 1
    The -a_ullr you enter are in degrees. They should be in the applied CRS. – AndreJ Nov 26 '13 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.