AnalyticalGraphicsInc/cesium — pull request #913 by kring (2013-06-29 19:36:55+00:00)
Title: Add support for a minimum level for imagery providers, especially TileMapServiceImageryProvider

With imagery covering only a small area of the globe, it's not necessary to generate a complete pyramid of tiles all the way up to level zero, since we'll be down to just one tile at a deeper level. In fact, this is what TMS tile generators like MapTiler and gdal2tiles.py do by default. However, Cesium previously didn't like it if the pyramid did not go all the way to level zero. It would try to request the tiles anyway, generating errors in the console, and then when those requests failed it wouldn't show any imagery at all from that provider until the user zoomed in close enough to request the level that did exist.

This pull requests fixes Cesium to properly support incomplete pyramids. This makes it much easier to generate TMS tile sets for use with Cesium because the MapTiler and gdal2tiles.py default settings will work nicely.

As a defensive mechanism, Cesium will ignore the minimum level specified in the tilemapresource.xml file if honoring it would indicate that there are more than 4 tiles at the minimum level. Our Black Marble imagery is like that currently, and wouldn't work without this check. I think that's because I hacked it up, though.

You can test this pull request by pointing to http://fuzz.homeserver.com/tiles with `TileMapServiceImageryProvider`. The Black Marble Sandcastle example makes it easy to do, but don't forget to remove the explicit maximum level property in that example. See http://fuzz.homeserver.com/tiles/tilemapresource.xml for evidence that not all levels are present. I generated this tile set from a single Landsat 8 scene.