using createTileMapServiceImageryProvider with gdal2tiles

I think i was going about getting my geotiffs on cesium all wrong. I was insisting on using KML but I think I don’t need to do that as gdal2tiles seems to write out tms which i believe createTileMapServiceImageryProvider can help with. The problem is this:

I have a script htat processes some goe tiffs into what I thought was TMS format using gdal2tiles. The thing is when I try to create a viewer to use this info:

var l1924 = layers.addImageryProvider(new Cesium.createTileMapServiceImageryProvider({

url:‘myTiles/tiles’,

minimumLevel: 9,

maximumLevel: 14,

credit: ‘moi’

}));

I get no errors in the imagery provided layers but it does fail to load a lot of png files from the tileset. I realize the numbers are just only slightly off than the tile set I have on disk and I cannot figure out what is causing this.

So on my disk my gdal2tiles created this:

Location

10/66/314.png

10/66/315.png

but cesium is looking for it in the 9 directory e.g:

315.png:1 GET http://localhost:8000/static/swsite/images/processed/Maui/kml/test/**9/**66/315.png 404 (Not Found)

315.png:1 GET http://localhost:8000/static/swsite/images/processed/Maui/kml/test/**9/**67/315.png 404 (Not Found)

no idea why the diff or how to get them to sync up

The tilemapsource.xml file:

<?xml version="1.0" encoding="utf-8"?> Maui.nitf

EPSG:4326

for completeness I should say that the loading in the javascript points to myTiles/tiles folder, in reality it is the correct folders as given above that is it pointing too so:

url:

url: ‘static/swsite/images/processed/Maui/kml/test’

Hello Shane,

i think cesium uses the mercator tilingschema as a default, so your dataset which is in the geodetic profile is not working.

But you can add the following.

var l1924 = layers.addImageryProvider(new Cesium.createTileMapServiceImageryProvider({

url:‘myTiles/tiles’,

tilingScheme : new Cesium.GeographicTilingScheme(),

minimumLevel: 9,

maximumLevel: 14,

credit: ‘moi’

}));

I hope this will help you

Jannes

Thank you Jannes, I did try both the code and calling

gdal2tiles.py -p mercator my.nitf

and the results were the same, cesium was looking for file names that existed in wrong folders though. I did add that snippet of code too, not sure if I did something else noticeably wrong but same result from the above methods.

Shane

Sorry to resurrect such an old thread, but I've been struggling with exactly the same problem. My solution was to set "geodetic" profile in gdal2tiles.py with -p, and the -d flag to set "TMS compatible".

Thanks bf1,
Your suggestion to add to gdal2tiles the flags -p geodetic and -d (or --tmscompatible) was helpful. gdal2tiles gave me quite a bit of trouble. I think it should be better documented, in the context of preparing tiles for Cesium.
Ram