The reason some of the objects in simple.czml don’t have three references is because they are not polygons. The minimum number of references is going to be different for each kind of object.
Also with the pictures you sent I think I have a much better idea of what you were trying to do. What I was trying to do was make a polygon between all your objects, rather than draw a rectangle around each individual one. I think the best way is to use the box outline geometry, and set the center as an object you have. You won’t need to use the references for this because we can call the position directly.
What the following code is doing is setting the z-dimension of the box to zero so you end up with a flat rectangle. I pulled this from the box outline geometry example in sandcastle and made slight modifications. To change the size of your rectangle, just edit the dimensions variable. The other place you might have to check the variable names is for the positionOnEllipsoid. Make sure the name of your data source matches and it has the correct id string. You can make a new box outline for each individual object, rather than needing three references.
// Draw the outline of a box.
var dimensions = new Cesium.Cartesian3(400000.0, 400000.0, 0.0);
// Box geometries are initially centered on the origin.
// We can use a model matrix to position the box on the
// globe surface.
var positionOnEllipsoid = czmlDataSource.entities.getById(“object1”).position.getValue(viewer.clock.currentTime);
var boxModelMatrix = Cesium.Matrix4.multiplyByTranslation(
Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid),
new Cesium.Cartesian3(0.0, 0.0, dimensions.z * 0.5), new Cesium.Matrix4());
// Create a box outline geometry.
var boxOutlineGeometry = Cesium.BoxOutlineGeometry.fromDimensions({
dimensions : dimensions
});
// Create a geometry instance using the geometry
// and model matrix created above.
var boxOutlineInstance = new Cesium.GeometryInstance({
geometry : boxOutlineGeometry,
modelMatrix : boxModelMatrix,
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE)
}
});
// Add the geometry instance to primitives.
scene.primitives.add(new Cesium.Primitive({
geometryInstances : boxOutlineInstance,
appearance : new Cesium.PerInstanceColorAppearance({
flat : true,
renderState : {
lineWidth : Math.min(2.0, scene.maximumAliasedLineWidth)
}
})
}));
``
Try adding that code right below where you load the czml you created. Hopefully it will make the box that follows around your object, just be sure to check that all the syntax/variable names match up with your code.