google-mapsgdalmaptiler

Error when using spatial reference EPSG:3440 in gdal2tiles.py


I was using gdal2tiles.py with spatial reference WSG84 and it was working fine. However, when I changed to spatial reference EPSG:3440. I got the the following error:

First, I run the command:

gdal_translate -of VRT -a_srs EPSG:3440 -gcp 0 0 58.068451479718924 23.65512391903488 -gcp 21816 0 58.126966134442846 23.65512391903488 -gcp 21816 14871 58.126966134442846 23.6185834507829  myinputimage.png myoutput.vrt

Than, I run the command:

python gdal2tiles.py  myoutput.vrt

I got the following error: enter image description here

Is there is way to fix this error or use similar spatial reference which doesn't have this error. Notice, this error happen only when using spatial reference other than WSG84.

EDIT: I guess the issue could be that spatial reference EPSG:3440 is not inculded, but the question remain, is there away to add it to gdal reference database.


Solution

  • The EPSG:3440 is a projected system. The correct definition for accuracy 0.5 meter would be probably:

    +proj=utm +zone=40 +ellps=clrk80 +towgs84=-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006 +units=m +no_defs 
    

    If I have a look at http://epsg.io/3440-1439 it tells:

    Projected bounds:
    -35283.71 1840661.51
    789562.66 2942956.58
    

    In your command above you assign ground control points which looks like geodetic (latitude longitude numbers) such as 58.068451479718924. This is very probably wrong - as the numbers you assign are not in the projected bounds range.

    You must very use in the -gcp parameter of the gdal_translate numbers which are bigger - already projected and in the above range.

    It is possible to transform your lat/lon from WGS84 via the online interface at: http://epsg.io/3440-1439/map and assign in the -gcp argument the transformed numbers.

    You have marked your query with tag maptiler which refers to http://www.maptiler.com/. This tool would be able to assign the coordinates visually as well without a need to create VRTs - so you can click on your image and copy&paste the above coordinates in a projected system. MapTiler generates a viewer which display the EPSG:3440 tiles in OpenLayers or transform these to a spherical mercator tiles for overlays with Google or OSM or use in mobile apps.

    BTW glad to hear you use the systems gdal2tiles, maptiler and http://epsg.io/ which we have developed...