Error in ImageryLayer while adding a SingleTileImageryProvider to the globe

(Apologies if this winds up as a dupe post - tried posting this topic earlier, but it seems to have been swallowed by Google Groups.)

I’m seeing an error down inside ImageryLayer while trying to add a SingleTileImageryProvider with a limited Rectangle to the globe. We’ve got code that adds/removes that image with a new URL and Rectangle as some of our data changes. Here’s the stack trace from Firebug (note that “Cesium_debug.js” is the unminified version of Cesium.1.1):

TypeError: surfaceTile is undefined

ImageryLayer.prototype._createTileImagerySkeletons()Cesium_debug.js (line 108433)

GlobeSurfaceTileProvider.prototype._onLayerAdded/<()Cesium_debug.js (line 109584)

QuadtreePrimitive.prototype.forEachLoadedTile()Cesium_debug.js (line 111152)

GlobeSurfaceTileProvider.prototype._onLayerAdded()Cesium_debug.js (line 109583)

Event.prototype.raiseEvent()Cesium_debug.js (line 4396)

ImageryLayerCollection.prototype.add()Cesium_debug.js (line 110131)


We’re currently using Cesium 1.1, after having upgraded from b17 to b29, and then to 1.1. We don’t have any automated testing set up, so I’m not sure exactly when this regression started. The application code that’s calling ImageryLayerCollection.add() hasn’t changed in a while, so my guess is that it has to do with the Cesium upgrades. I may try checking out an earlier revision if I get some time, and see if there’s a difference.

A couple interesting notes here:

  • The image does correctly show up on the globe, despite the error.
  • While the error killed my app’s execution enough that it wasn’t able to continue updating the imagery. However, when I stuck a try/catch+log around the call to ImageryLayerCollection.add(), my app was able to keep adding and removing imagery layers, without that error being thrown again.
    The try/catch seems to work as an adequate bandaid, but I’m very hesitant to just rely on that without knowing what the real issue is. The error’s obviously down inside Cesium, but the root cause could easily be something in my application.

Anyone out there have any ideas what might be going on?


Mark Erikson

Ah, yes, one item I forgot to mention from the original post attempt:

I did see a recent commit to ImageryLayer that had to do with limited-size Rectangles. I tried manually editing my copy of Cesium with those changes, and it didn’t seem to make any difference. Didn’t necessarily expect it to, but wanted to make sure that wasn’t related.

Hi Mark,

That definitely sounds like #416, which was fixed by this pull request:

The change is already in master and will ship in Cesium 1.3.


Actually, sorry, that’s the wrong issue. It’s more likely this one, fixed in 1.2:

Aaaaaand time to upgrade again. Might have to go look at the model orientation changes - we had just added some 3D models to our app, and I may have to re-export them.

As always, thanks for all the great work you guys have put into Cesium.

Mark Erikson