Hi I’m new to cesium and seems very interesting what we can do with CZML.
I was wondering if there is the possibility to animate the extruded height of polygon loaded from a GeoJsonDataSource through a different CzmlDataSource, or CZML only animate it’s own specified objects.
Can i bind object ids from the geojson datasource to object ids of the czml?
I’m fairly new to Cesium also, so someone may have a better answer. I don’t think you can automatically bind two datasources, but you can drill down into each datasource’s items’ properties. I’m working with GeoJson only, and I use the following code to find a specific geometry based on its ID in a specific datasource when a related object is selected elsewhere in my application:
var selectedOption = dataGrid().getSelection()[0];
var geoJsonEntities = viewer.dataSources.get(0).entities.entities;
for (var x=0;x<geoJsonEntities;x++) {
if (geoJsonEntities[x].properties.id == selectedOption.affectedGeometry.id) {
if (geoJsonEntities[x].billboard) { //geojson points are assigned a billboard by the geojsondatasource
geoJsonEntities[x].billboard.image = new Cesium.ConstantProperty(pinBuilder.fromColor(impactedColor, 24).toDataURL());
} else if (item.polygon) {
geoJsonEntities[x].polygon.material = Cesium.ColorMaterialProperty.fromColor(impactedColor);
} else {
console.info('entity is something other than a point or polygon', geoJsonEntities[x]);
}
}
}
``
The first datasource I load is always GeoJson, so I get that specific one (dataSources.get(0)), then I loop through that dataSource’s entities to find the ones that should be changed based on the selectedOption’s affectedGeometry ID. My GeoJson has a a “properties” property that contains the data I want to associate with other things in my application, like the selectedOption: