4

I am trying to generate map tiles using gdal2tiles for an area much larger than MapTiler can handle. However, my tile caches are not showing up on the maps. I checked gdal2tiles by running the same file through it and MapTiler - and the outputs come out differently. Here's my gdal2tiles command:

/usr/local/Cellar/gdal/1.9.0/bin/gdal2tiles.py -p mercator --s_srs 3857 -z 1-9 -v myFile.tiff

For instance, in the maptiler output, I get the file

9/85/197.png

While gdal gives me different files, like

9/85/313.png

The output should be identical, right? Is there something I'm missing? My projection on the original file is definitely correct. I have also tried gdal2tiles with 900913. I am running gdal2tiles on MacOS X Mountain Lion, gdal 1.9.0.

4
  • 1
    check out your profile whether mercator or geodetic. it looks like your first output is mercator and second is geodetic.
    – urcm
    Commented Apr 12, 2013 at 13:11
  • That's interesting.. but as you can see, I am calling gdal2tiles.py with the -p mercator argument, and mercator is also the default anyway. Do we think that that gdal2tiles could be broken in this reqard?
    – deepwinter
    Commented Apr 12, 2013 at 17:01
  • 1
    possible duplicate of GDAL2Tiles: MapTiles from BSB/KAP are Switched
    – AndreJ
    Commented Aug 27, 2013 at 10:08
  • It is completely a duplicate and worked fine with your tip! Thanks !
    – F3L1X79
    Commented Nov 18, 2016 at 11:09

2 Answers 2

2

It's because gdal2tiles generates the tiles in TMS format. You need to enable it on your map or do a small calculation on the fly in order to display the tiles.

1
  • maptiler have -tms switch to produce results same as gdal2tiles.py.
    – mrgloom
    Commented Jan 18, 2017 at 14:07
1

It is the difference between TMS and XYZ/WMTS addressing of the same mercator tile.

See the detailed description and mashup I made at:

http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/

GDAL2Tiles renders always TMS.

The scripts and equations for conversion of the flipped y-coordinate are mentioned in the MapTiler User Group on Google Groups.

If you render the map tiles with the new MapTiler (http://www.maptiler.com/) you can choose whether you want TMS or XYZ/WMTS addressing of the tiles. This option is available under the "Advanced options" button.

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.