My Goal is the have BoxGeometry plot on the globe based on a file from a webserver. The next phase is to click and drill down on it. This is what I have done so far.

  1. I could retrieve the file which says what to plot from the webserver using jquery.

  2. Call the function [1] to create all the boxgeometryinstances I needed.

  3. Then call [2] to have it plotted on Globe.

  4. I have included the first three inside “setInterval” function which gets called every 5 seconds.

  5. When I try to remove the boxgeometry which is no longer required after 10 seconds I am unable to with primitive.remove, However primitive.removeAll() removes everything with a blink which I would like to avoid. I am wondering why primitive.remove of the first object won’t remove the bar plotted on the globe even when it say “True” for variable a in “var a = scene.primitives.remove(primitive[1]);”. I guess it might partly be due to the fact that I am reinitializing the primitive in function[2].

I have a question about primitive.remove.

function plotROD(lat, lon, height, id) {

    var dimensions = new Cesium.Cartesian3(100000.0, 100000.0, height);

    var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(lon, lat);

    var boxModelMatrix = Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid),

                                                                new Cesium.Cartesian3(0.0, 0.0, dimensions.z * 0.5));

    var boxGeometry = Cesium.BoxGeometry.fromDimensions({

                        vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,

                        dimensions : dimensions });

    boxGeometryInstance.push(new Cesium.GeometryInstance({

                                geometry : boxGeometry,

                                modelMatrix : boxModelMatrix,

                                attributes : {color : Cesium.ColorGeometryInstanceAttribute.fromColor(

                                                        new Cesium.Color(1.0, 0.0, 0.0, 1)),},

                                id : id,


for( pi=0; pi < boxGeometryInstance.length; pi++ ) {

        primitive[pi] = new Cesium.Primitive({

                        geometryInstances : boxGeometryInstance[pi],

                        appearance : new Cesium.PerInstanceColorAppearance({

                                        translucent : false,

                                        closed : true




test.html (4.66 KB)