Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for a minimum level for imagery providers, especially TileMapServiceImageryProvider #913

Merged
merged 5 commits into from
Jun 30, 2013

Conversation

kring
Copy link
Member

@kring kring commented Jun 29, 2013

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.

kring added 5 commits June 29, 2013 13:44
This way the default gdal2tiles.py behavior of only generating tiles up to
the first level that has only one tile will not confuse Cesium.
@kring
Copy link
Member Author

kring commented Jun 29, 2013

One last thing: it would be nice to get this into b18, assuming no one sees anything scary about it. It's a very simple change that fixes a problem that several people have had when trying to get imagery into Cesium.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 30, 2013

Tests pass. Code is good (not sure why the function is optional, but OK I guess). Works as advertised in the Sandcastle example.

pjcozzi added a commit that referenced this pull request Jun 30, 2013
Add support for a minimum level for imagery providers, especially TileMapServiceImageryProvider
@pjcozzi pjcozzi merged commit ecebfd1 into master Jun 30, 2013
@pjcozzi pjcozzi deleted the minimumLevel branch June 30, 2013 12:19
@kring
Copy link
Member Author

kring commented Jun 30, 2013

It's optional for backward compatibility because I know of several custom imagery providers out there. Of course, it wouldn't be a difficult breaking change to deal with, so I can go either way on it.

@fobetor
Copy link

fobetor commented Nov 21, 2013

I'm totally new to Cesium, but I am having trouble with this issue about tile levels with other tile provider formats, such as openstreet.
The point is that Cesium seems to need every level from 0 to maximum to draw the tiles. I'm trying to use a map from level 3 to 8 in OSM format, but Cesium stops because he dont find initially the level 0 tiles.
IS there a way to just tell him that this leyer I'm using just has renderes tiles for leves 3 to 8 ? Or I need to change all the aproach and render them in a generic TMS?
This same thing applies to any other tileprovider (Esri, etc....)
thanks in advance

@kring
Copy link
Member Author

kring commented Nov 21, 2013

@fobetor currently only TileMapServiceImageryProvider makes use of the minimum level. It should be a straightforward change to add that capability to OpenStreetMapImageryProvider as well. OpenStreetMapImageryProvider.js line 190 (in the getMinimumLevel function) just needs to return the minimum level. The minimum level to use should presumably be supplied to the constructor. If you decide to make this change, we'd welcome a pull request.

@fobetor
Copy link

fobetor commented Nov 21, 2013

Thank you, I'll try it. I'm not a programmer, so I dont know what final results I will have,,, ;-)
I will maintain you informed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants