7

I am new to gdal and have a simple question. I want to transform an image from OpenStreetMap projection to Nasa Blue Marble projection. What I understand is that OpenStreetMap projection is EPSG:3857 and Blue Marble projection is EPSG:4326 (http://www.paulillsley.com/gia/index.html).

So, I simply downloaded a sample 256*256 tile like this: http://a.tah.openstreetmap.org/Tiles/tile/0/0/0.png and applied the following command:

gdalwarp -s_srs EPSG:3857 -t_srs EPSG:4326 "0.png" "o_bluemarble.png"

I received the following error: "Copying color table from 0.png to new file. ERROR 1: Unable to compute a transformation between pixel/line and georeferenced coordinates for 0.png. There is no affine transformation and no GCPs."

From where should I start?

Update 1

I got it. I need to define the bounds. Firstly, I got the bounds:

gdaltransform -s_srs EPSG:4326 -t_srs EPSG:3857
-180 85.05
-20037508.3427892 20036051.9193368 0

I used 85.05 as it is the approximation to infinity in Spherical Mercator used by Bing. Then, I used the following commands:

./gdal_translate -of Gtiff -co "tfw=yes"  -a_ullr -20037508.3427892 20036051.9193368 20037508.3427892 -20036051.9193368 -a_srs "EPSG:3857"  "input.png" "input_tfw.tiff"

./gdalwarp -s_srs EPSG:3857 -t_srs EPSG:4326 -ts 256 128 "input_tfw.tiff" "output.tif"

The problem now is that by comparing an image downloaded from openstreetmap with Blue Marble, the poles are not aligned properly. I mean here Greenland, not the far pole. What do think the problem is?

1
  • 85,05° N is not really Google's approximation for infinity. It is just chosen to get a square tile for zoom level 0. It is true that 90°N will be infinity in that projection, but everything between 85 and 89.99 can be projected, though rather distorted.
    – AndreJ
    Aug 30, 2013 at 10:56

1 Answer 1

2

I'm not sure what your problem is. The image I get from OSM looks like this:

OSM topmost tile

And after running your commands I get this:

WGS84 image

Which looks like how I would expect a lon/lat dataset to look, which is essentially an equirectangular projection:

enter image description here

1
  • There was a slight shift near poles but I fixed it by providing a more accurate lat value (85.0511). Thanks.
    – egsemsem
    Nov 30, 2011 at 4:09

Your Answer

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

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