I'm new to GDAL and map projections, I need to convert equirectangular (EPSG:4326?) projection to "pseudo Mercator" (EPSG:3857?) projection used by 90% web-based maps (which is simple this 0/0/0 file of any OSM tileserver: https://tile.openstreetmap.org/0/0/0.png). I have the following EPSG:4326 example:

ESPG:4326 wold map projection

I run the following commands:

gdal_translate -a_ullr -180 85.05 180 -85.05 -a_srs EPSG:4326 4326.png 4326.tiff
gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 4326.tiff 3857.png

But the output (to the left) is obviously not the same as the EPSG:3857 example (to the right):

My result vs EPSG:3857

I feel like I need some offset parameter from the top of the source, or I set wrong a_ullr parameter, or I chose wrong projections. In other words: I need to make a googlemap-like image from the given source. How can I do it in a correct way?

  • I would first look at making sure your tiff is in 4326. Going from a non-spatial format (png) to a spatial format (tif)
    – GeoMonkey
    Nov 8, 2022 at 20:26
  • How do you know the ullr coordinates of your source image? Where does "EPSG:3857 example (to the right)" come?
    – user30184
    Nov 8, 2022 at 21:33
  • @Nate I thought it's made with gdal_translate?
    – Martin
    Nov 9, 2022 at 4:10
  • @user30184 I'm not sure about ullr parameter, I've looked different sources, spatialreference.org says it should be -180 90 180 -90 but then I get a very strange vertical picture 133x1605px. I've played with it a bit but it seems there's no way to make less space above the Greenland, you can only shift the map center to the north/south. The example of EPSG:3857 "web mercator" comes directly from OSM map, it's the same as many results you can google with this keyword (wikipedia for example).
    – Martin
    Nov 9, 2022 at 4:26
  • The ullr parameters must match with the area that your original image presents. Do you have any metadata about it?
    – user30184
    Nov 9, 2022 at 7:08

1 Answer 1


I think I've found a solution: so the -a_ullr bounds for the source projection will be -180 90 180 -90, and then I've learned that EPSG:3857 has an extent in coordinates which is -20037508.34 -20037508.34 20037508.34 20037508.34. So the commands will be:

gdal_translate -a_ullr -180 90 180 -90 -a_srs EPSG:4326 4326.png 4326.tiff
gdalwarp -te -20037508.34 -20037508.34 20037508.34 20037508.34 -s_srs EPSG:4326 -t_srs EPSG:3857 4326.tiff 3857.png

And now it looks much better:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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