Hai Hannah.
Thank you so much for the reply. Actually the problem is i have two geojson layers loaded in cesium and added the terrain effect. One is line geometry road and polygon geometry building. The polygon geometry has height information and line doesnot have. Am completely new to Cesium. Below is my code please help me to scale the buildings to the correct height.
function startup(Cesium) {
‘use strict’;
//Sandcastle_Begin
//Load a GeoJSON file containing simplestyle information.
//To learn more about simplestyle, see https://github.com/mapbox/simplestyle-spec
//In this particular example, the name of each entity is set to its maki icon identifier.
//Clicking on each billboard will show it’s identifier in the InfoBox.
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
timeline: false,
animation : false,
vrButton : true,
selectionIndicator : false
});
//var terrainProvider = new Cesium.CesiumTerrainProvider({
// url : ‘//assets.agi.com/stk-terrain/world’
//});
//viewer.terrainProvider = terrainProvider;
//Example 3: Apply custom graphics after load.
Sandcastle.addToolbarButton(‘3D View’, function() {
//Seed the random number generator for repeatable results.
Cesium.Math.setRandomNumberSeed(0);
var dataSource1 = new Cesium.GeoJsonDataSource();
var roads = dataSource1.load(’…/…/SampleData/Roads_Hubli.geojson’);
roads.then(function(dataSource1) {
viewer.dataSources.add(dataSource1);
viewer.zoomTo(dataSource1);
//Get the array of entities
var entities1 = dataSource1.entities.values;
var colorHash = {};
for (var i = 0; i < entities1.length; i++) {
//For each entity, create a random color based on the state name.
//Some states have multiple entities, so we store the color in a
//hash so that we use the same color for the entire state.
var entity = entities1[i];
var name = entity.name;
var color = colorHash[name];
if (!color) {
color = Cesium.Color.BLACK;
colorHash[name] = color;
}
//Set the polygon material to our random color.
entity.polyline.material = color;
//Remove the outlines.
entity.polyline.outline = false;
}
}).otherwise(function(error){
//Display any errrors encountered while loading.
window.alert(error);
});
var dataSource2 = new Cesium.GeoJsonDataSource();
var promise = dataSource2.load(’…/…/SampleData/Hubli_Buildings.geojson’);
promise.then(function(dataSource2) {
viewer.dataSources.add(dataSource2);
viewer.zoomTo(dataSource2);
//Get the array of entities
var entities2 = dataSource2.entities.values;
var colorHash = {};
for (var i = 0; i < entities2.length; i++) {
//For each entity, create a random color based on the state name.
//Some states have multiple entities, so we store the color in a
//hash so that we use the same color for the entire state.
var entity = entities2[i];
var name = entity.Elev_in_m;
var color = colorHash[name];
if (!color) {
color = Cesium.Color.BROWN;
colorHash[name] = color;
}
//Set the polygon material to our random color.
entity.polygon.material = color;
//Remove the outlines.
entity.polygon.outline = false;
//Extrude the polygon based on the state’s population. Each entity
//stores the properties for the GeoJSON feature it was created from
//Since the population is a huge number, we divide by 50.
entity.polygon.extrudedHeight = entity.properties.Elev_in_m;
}
}).otherwise(function(error){
//Display any errrors encountered while loading.
window.alert(error);
});
});
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== “undefined”) {
startup(Cesium);
} else if (typeof require === “function”) {
require([“Cesium”], startup);
}
And the lat and long for the data is 15.3647, 75.1240.