A Firefox issue and my April 3 post

I am using Firefox 37.01 on a Windows 7 machine and am seeing some erratic behavior from the following entity.

    var thebox=viewer.entities.add({
                                   name : 'Area Boundary',
                                   polygon :{
                                   hierarchy : Cesium.Cartesian3.fromDegreesArray([
                                   material : Cesium.Color.GREEN.withAlpha(0.9),
                                   outline : true,
                                   outlineColor : Cesium.Color.BLACK,
                                   height : -5.0

What is happening is that the outline is present but the green interior goes on and off as I step through the Menu.
Again, the URL is http://vcities.ite-stl.org/Cesium/Apps/Sandcastle/gallery/Cesiumblocktest.html. I see the expected behavior with Chrome,

I also updated Cesiumblocktest.html a bit to focus on the anomaly I had previously posted about. I added two essentially identical entities, buildings, one inside the boundary of the entity above and one outside. That is, the only difference is in their long/lat s. They both appear to be off the ground although their height = 0.0. I have been unable to find documentation explaining the entity interaction.

Cesiumblocktest.html (7.48 KB)

The two identical buildings appear to be right on the ground.

I wouldn’t expect any consistency when burying objects into the ground. Currently it draws the entire object, including what should be clipped by the terrain, but that could change down the road. The green rectangle shouldn’t be visible at all, but not only is it visible, but it is masking the terrain’s texture. Maybe for now pre-clip the buried portions of buildings before placing into Cesium.

Maybe in the future Cesium could terrain clip objects and see just what is above the terrain when the camera is above the terrain, and see just what is below the terrain when the camera is below the terrain.

Actually nothing shows when in terrain mode, only in ellipsoid mode, due to the terrain being over the ellipsoid. Perhaps terrain mode does have clipping, just not in ellipsoid mode? Have you tried placing the buildings’ bases at the terrain height?


I should have mentioned that we have imported a number of complex buildings, individually, and they look really good. The basement issue just came up because the problem we face is that we are trying to minimize the work involved in moving a library of .kmz files that we have built. If the basements need to be clipped, so be it.

You don’t plan to place the buildings on the actual terrain, only on the reference ellipsoid? Maybe you don’t need to clip the basements if you place them on the actual terrain. You can use viewer.scene.globe.getHeight to get the terrain height relative to the ellipsoid at certain lon/lat coordinates. By default terrain is off, but there is a way to turn it on at start-up.

In the KMZs (zipped KMLs) do you specify altitude mode?


“Any KML feature with no altitude mode specified will default to clampToGround.”

Absolute mode is actually geoid/MSL relative. Bad name really, the word absolute is usually reserved as a reference to something symmetrical like an ellipsoid, not an irregular shape like the geoid.

Yet again, Thank You!

We are meeting later this week to try to plan a way forward. Hopefully, I will have been able to have processed all of your good advice by then.

You’re welcome, I hope there is an easy solution! Maybe one could experiment with a sandcastle app and see if ents are clipped by the terrain. They are definitely not clipped by the reference ellipsoid.

The terrain height at -90.1922703175, 38.6286636758 is 110.139218977672 meters above the ellipsoid. Using a box whoms bottom is 30 meters below it’s center I made a sandcastle with buttons that shows that the terrain does clip the building. The up one meter function doesn’t work, I’m not sure why. Be sure to turn on terrain. When center is at 140 meters, the bottom is at 110 meters.

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var thebox = viewer.entities.add({

name : 'building',

position: Cesium.Cartesian3.fromDegrees(-90.1922703175, 38.6286636758, 30),

box : {

    dimensions : new Cesium.Cartesian3(40, 30, 60),

    material : Cesium.Color.RED,

    outline : true,

    outlineColor : Cesium.Color.BLACK




function gohere(height)


var test = new Cesium.Cartographic(-90.1922703175/180*Math.PI,38.6286636758/180*Math.PI,height);

var mypos = Cesium.Ellipsoid.WGS84.cartographicToCartesian(test);

thebox.position = mypos;    


Sandcastle.addToolbarButton(‘up 1 meter’, function()


var mycarto = new Cesium.Cartographic();

mycarto = Cesium.Ellipsoid.WGS84.cartesianToCartographic(thebox.position);


thebox.position = Cesium.Ellipsoid.WGS84.cartographicToCartesian(mycarto);


Sandcastle.addToolbarButton(‘0’, function()


Sandcastle.addToolbarButton(‘120’, function()


Sandcastle.addToolbarButton(‘130’, function()


Sandcastle.addToolbarButton(‘140’, function()


Sandcastle.addToolbarButton(‘150’, function()


Sandcastle.addToolbarButton(‘160’, function()



Thanks for the Cube Demo, it was a great learning experience for me and I finally got “Up 1 meter” to work.
I ended up saving your code out of Sandcastle and putting it up as
http://vcities.ite-stl.org/Cesium/Apps/Sandcastle/gallery/CesiumCubeTest.html . I then went at it with Firebug. I still don’t know why some of the things I did didn’t work. I could see values change seemingly correctly in the debugger, but nothing happened. I left my bad code, commented out, in place.
In the end all I did was just reuse your gohere(height).
I introduced a variable var theheight=30 and updated it as I went through the various heights. For up 1 meter the code is
Sandcastle.addToolbarButton(‘up 1 meter’, function()

Creating a height variable works! I don’t know why Cesium.Ellipsoid.WGS84.cartesianToCartographic(thebox.position); yields all NaNs. Doing a console.log(thebox.position) I see the .x .y .z buried in a ConstantPositionProperty, not as top level properties.

With viewer.scene.globe.getHeight it’s real easy to clamp objects to the terrain, which I suspect to be the case in the kml files.

I was seeing a lot NaN s as well. I just stared at it again and found that this works as well.

    var aclock = new Cesium.Clock({
                                 startTime : Cesium.JulianDate.fromIso8601("2015-04-07"),
                                 currentTime : Cesium.JulianDate.fromIso8601("2015-04-07"),
                                 stopTime : Cesium.JulianDate.fromIso8601("2015-04-08"),
                                 clockRange : Cesium.ClockRange.LOOP_STOP,
                                 clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER


    Sandcastle.addToolbarButton('up 10 meter', function(){

                              var theposition = thebox.position.getValue(aclock.currentTime);

I used 10 to make the effect a bit more dramatic.
The code is at

stop doesn’t do anything, perhaps you forgot to delete that.

place these lines after thebox.position=theposition;



one has top level .x .y .z properties, the other has .x .y .z under other properties.

BTW z is moving along world z, not local EastNorthUp z. World z is along the Earth pole which only matches local ENU z at the north pole. You can use Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(theposition) to get the direction of local ENU z. Then scale that vector by how much you wish to move, then add the resulting vector to the thebox.position. I didn’t think about doing it that way earlier.

Thanks, that’s very useful information.

By the way, I did forget to remove the stop , I just use them for debugging references.

I’ve created a related thread here: https://groups.google.com/forum/#!topic/cesium-dev/imIpoZHvKrM