I am trying to create an animation of annual heat maps over a 30 year time span. I have generated a 3D GeoJson layer and styled it accordingly. What I’m trying to do now is animate the 30 years of heat maps and show the change over time.
I’m not seeing much in the Cesiumjs resources about how I would go about this and I’m wondering if anyone has done this with a GeoJSON and could help me figure out a plan of attack?
var viewer = new Cesium.Viewer("cesiumContainer");
var options = {
camera: viewer.scene.camera,
canvas: viewer.scene.canvas
};
var promise = Cesium.GeoJsonDataSource.load('My_geoserver_geojsonpath');
promise.then(function (dataSource) {
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);
var entities = dataSource.entities.values;
var colorhash = {};
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
var name = entity.properties.Name;
var color = colorhash[name];
var outcolor;
var symID = entity.properties.SymbolID;
if (!color) {
if (symID == 0) {
color = Cesium.Color.FORESTGREEN.withAlpha(0.7);
outcolor = Cesium.Color.FORESTGREEN.withAlpha(1.0);
colorhash[name] = color;
} else if (symID == 1) {
color = Cesium.Color.GOLD.withAlpha(0.7);
outcolor = Cesium.Color.GOLD.withAlpha(1.0);
colorhash[name] = color;
} else if (symID == 2) {
color = Cesium.Color.ORANGERED.withAlpha(0.7);
outcolor = Cesium.Color.ORANGERED.withAlpha(1.0);
colorhash[name] = color;
} else {
color = Cesium.Color.MAROON.withAlpha(0.9);
outcolor = Cesium.Color.MAROON.withAlpha(1.0);
colorhash[name] = color;
}
}
entity.polygon.material = color;
entity.polygon.outlineColor = outcolor;
entity.polygon.extrudedHeight = entity.properties.Count * 20;
}
}).otherwise(function (error) {
window.alert(error);
});
``
Additionally, if I could have the layers shrink and grow as the date changes that would be a huge plus. I could possibly use something from D3 to do that animation transition but would also be open to something from Cesiumjs.
I am very new to Cesium and web development in general and would welcome any advice or tips!
I’m using Cesium 1.63.1 with google chrome and my GeoJSON layers are being stored in GeoServer 2.14.2
Thanks in advance!