Hi
I have three problems.
Problem 1:
I try to show the geojson data on terrain,so I add STK World Terrain meshes,
when I zoom in and zoom out , the view is below
https://drive.google.com/open?id=0BzSg1YTd_o3BRFNEV2kxU0Zkb3FzT1REa3BpNFRBYmxlLXc4
https://drive.google.com/open?id=0BzSg1YTd_o3Ba3d1YkVGX0xrSHJmdDRpREluSnNqTE1icmN3
https://drive.google.com/open?id=0BzSg1YTd_o3BV2lKTS14bVdfVUNLTE5ILV9DTExyS2pHZi1n
https://drive.google.com/open?id=0BzSg1YTd_o3BX3ZXWWVRSHI0U0M5Y1UzWDA4eEcxdEF0Si00
is it a problem for streaming terrain?
How to fix it?
Problem 2:
when i view taipei city after add STK World Terrain meshes,that place is so strange.
How to fix it?
Problem 3:
About terrain
can I use my tif file, if it is so bad after terrain ?
How to do?
thank you!
-------------
code below
var viewer = new Cesium.Viewer('cesiumContainer', {});
var terrainSamplePositions = ;
var promise = dataSource_r600_geojson.load('/SubareaGrid.geojson');
promise.then(function (dataSource2) {
viewer.dataSources.add(dataSource2);
viewer.zoomTo(dataSource2);
var colorHash = {};
for (var i = 0; i < entities2.length; i++) {
var entity = entities2[i];
var name = entity.properties.GRID_CODE;//依CLASS
if(name==1){
entity.polygon.material = new Cesium.Color(0,1,0,0.8);
entity.polygon.outline = false;
}
if(name==2){
entity.polygon.material = new Cesium.Color(0,0,1,0.8);
entity.polygon.outline = false;
}
if(name==3){
entity.polygon.material = new Cesium.Color(1,1,0,0.8);
entity.polygon.outline = false;
}
if(name==4){
entity.polygon.material = new Cesium.Color(1,0,1,0.8);
entity.polygon.outline = false;
}
if(name==5){
entity.polygon.material = new Cesium.Color(1,0,0,0.8);
entity.polygon.outline = false;
}
// TODO: More sanity checking for undefined values etc.
var position = entity.polygon.hierarchy.getValue().positions[0];
terrainSamplePositions.push(Cesium.Cartographic.fromCartesian(position));
}
// Asking for terrain heights is asynchronous, because the answer may
// reside on the terrain server.
Cesium.when(Cesium.sampleTerrain(viewer.terrainProvider, 12, terrainSamplePositions), function () {
for (var i = 0; i < entities2.length; i++) {
var entity = entities2[i];
var terrainHeight = terrainSamplePositions[i].height;
var name = entity.properties.GRID_CODE;
//test 2
if(name==1){
// The bottom of the building sits on the terrain.
entity.polygon.height = 0.1;//
// The top of the building adds the building height to the terrain height.
entity.polygon.extrudedHeight = 0;//拔高
}
if(name==2){
entity.polygon.height = terrainHeight+1;
entity.polygon.extrudedHeight = 0;
}
if(name==3){
entity.polygon.height = terrainHeight+2;
entity.polygon.extrudedHeight = 0;
}
if(name==4){
entity.polygon.height = terrainHeight+3;
entity.polygon.extrudedHeight = 0;
}
if(name==5){
entity.polygon.height = terrainHeight+4;
entity.polygon.extrudedHeight = 0;
}
}
});
--------------------------
the SubareaGrid.geojson as below
https://drive.google.com/open?id=0BzSg1YTd_o3BMXFRaUZKYkEyT1U