I have a map image that I have reprojected from OSGB36 to googleMaps projection (EPSG:900913). When I run gdal2tiles on the reprojected map, the results are not alligned with the google maps images (its not just out by a little bit but by 10's of miles).

If I run it through MapTiler (from maptiler.org) it is aligned fine. MapTiler asks for an SRS which I dont specify when using gdal2tiles. So I'm thinking I've missied out a stage?

Also when I run gdalinfo on the warped file, the coords of the corners seem wrong. E.g. for the bottom-left corner the latitude is 51.143906, but it should be 50.955887 for google maps.

2 Answers
2

It turns out that if you replace EPSG:900913 with either EPSG:3857 or EPSG:3785 in the gdal warping you get the google-map tiles correctly aligned. Apparently these codes are alternatives for the unofficial googleMaps EPSG:900913. Though there seems to be lots of confusion about which is the correct code - e.g. MapTiler doesnt recognise EPSG:3857.

I've added the sequence of commands I run to the question incase that helps spot what I'm doing wrong.
–
spiderplant0Dec 19 '10 at 19:49

The map isnt OSGB it is EPSG:900913. The original map was OSGB36, then I warped it to googlemaps EPSG:900913. The map link and gdalinfo dump are for the warped map in EPSG:900913.
–
spiderplant0Dec 20 '10 at 12:17

I don't think the output coordinate system, "Google Maps Global Mercator" is correct. As it stands, I would assume that the ellipsoidal math was used when converting to Mercator. Google Maps uses spherical math, so you either needs to use a Mercator implementation that supports only the sphere-based equations (or has a projection parameter that will trigger the correct equations), or the geographic coordinate system needs to be based on a sphere of R = 6378137.0 m. The different equations will cause a north-south offset.
–
mkennedyDec 21 '10 at 1:23