[GIS] gdal2Tiles output differs from MapTiler

gdalgdal2tilesmaptilerpythonraster

I'm in need to process a large batch of Landsat images with MapTiler and since the version I'm using (1.0 Beta 2) does not support multiple input files, I created a simple Python script that calls gdal2tiles for every file.

The problem is that using, apparently, the same settings, I get different coordinates.

This is the correct output from MapTiler:

 <?xml version="1.0" encoding="utf-8"?>
    <TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
      <Title>mar_apr.tif</Title>
      <Abstract></Abstract>
      <SRS>EPSG:900913</SRS>
      <BoundingBox minx="-26.36147186954573" miny="-65.83667775218426" maxx="-21.96598523780907" maxy="-62.31334995428857"/>
      <Origin x="-26.36147186954573" y="-65.83667775218426"/>
      <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>
      <TileSets profile="mercator">
        <TileSet href="6" units-per-pixel="2445.98490468750010" order="6"/>
        <TileSet href="7" units-per-pixel="1222.99245234375010" order="7"/>
        <TileSet href="8" units-per-pixel="611.49622617187504" order="8"/>
        <TileSet href="9" units-per-pixel="305.74811308593752" order="9"/>
        <TileSet href="10" units-per-pixel="152.87405654296876" order="10"/>
        <TileSet href="11" units-per-pixel="76.43702827148438" order="11"/>
        <TileSet href="12" units-per-pixel="38.21851413574219" order="12"/>
        <TileSet href="13" units-per-pixel="19.10925706787110" order="13"/>
      </TileSets>
    </TileMap>

And this is the incorrect output from gdal2Tiles:

<?xml version="1.0" encoding="utf-8"?>
    <TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
      <Title>mar_apr_CLIP1.tif</Title>
      <Abstract></Abstract>
      <SRS>EPSG:900913</SRS>
      <BoundingBox minx="-25.32504747468283" miny="1.94797423573108" maxx="-21.33272919903126" maxy="5.10698976386579"/>
      <Origin x="-25.32504747468283" y="1.94797423573108"/>
      <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>
      <TileSets profile="mercator">
        <TileSet href="6" units-per-pixel="2445.98490468750010" order="6"/>
        <TileSet href="7" units-per-pixel="1222.99245234375010" order="7"/>
        <TileSet href="8" units-per-pixel="611.49622617187504" order="8"/>
        <TileSet href="9" units-per-pixel="305.74811308593752" order="9"/>
        <TileSet href="10" units-per-pixel="152.87405654296876" order="10"/>
        <TileSet href="11" units-per-pixel="76.43702827148438" order="11"/>
        <TileSet href="12" units-per-pixel="38.21851413574219" order="12"/>
        <TileSet href="13" units-per-pixel="19.10925706787110" order="13"/>
      </TileSets>
    </TileMap>

Does MapTiler perform any other operations besides running gdal2Tiles?

Best Answer

There are two different ways that Tiles can be addressed, the TMS standard specifies that tile coordinates start at the bottom left, but in practice most software is using a coordinate system with the Y axis reversed from TMS: it starts at the top left instead of the bottom right. I don't know that there is really an official name for this scheme, some people refer to it as google XYZ.

gdal2tiles uses the traditional TMS scheme, and this is not likely to change, where MapTiler is using the google scheme.

There are a couple options:
- Modify gdal2tiles to change the output file names.
- Do some bulk file renaming after tiling.
- you could probably get whatever is consuming the images to read the files as is. Most software can read either addressing scheme.

Related Question