load_cesium.js 1.89 KB
Newer Older
Joe T.S.'s avatar
Joe T.S. committed
1
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmMGJkYzQwZS1lNTI2LTQ1N2UtYjEyNy1lMjJiYjg2YjIxYmQiLCJpZCI6MTcxNDQsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NzE3Mjc2Njl9.C_XxMaj0_rAu-ADAkpcjcdzcccEMZ-cdbcn4fi5qby8';
Joe T.S.'s avatar
Joe T.S. committed
2
var viewer = new Cesium.Viewer('cesiumContainer', {
Joe T.S.'s avatar
Joe T.S. committed
3
    //terrainProvider: Cesium.createWorldTerrain(),
Joe T.S.'s avatar
Joe T.S. committed
4
5
    baseLayerPicker: true,
    vrButton: true,
Joe T.S.'s avatar
Joe T.S. committed
6
    //scene3DOnly: true,
Joe T.S.'s avatar
Joe T.S. committed
7
8
9
10
11
12
13
14
15
    geocoder: false,
    //terrainExaggeration: 1.5,
    navigationHelpButton: false,
    selectionIndicator: false,
    shadows: true,
    timeline: false,
    sceneModePicker: true,
    //infoBox: false,
    //geocoder: false
JOE XMG's avatar
update    
JOE XMG committed
16
17
18
    imageryProvider: new Cesium.OpenStreetMapImageryProvider({
        url: 'https://a.tile.openstreetmap.org/'
    }),
Joe T.S.'s avatar
Joe T.S. committed
19
});
Joe's avatar
Joe committed
20
21
22
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    // url: "../3dtile_nyc/tileset.json",
    // url: "http://193.196.37.89:8092/AssetsHFT/3DTile_Niedernhalle/tileset.json",
Joe's avatar
up    
Joe committed
23
    // url: "http://steinbeis-3dps.eu:8080/3DContainerTile/collections/NewYork/3DTiles/",
Joe T.S.'s avatar
Joe T.S. committed
24
    // url: "https://3d.hypotheticalhorse.com/collections/NewYorkBuildings/3dtiles/",
Joe T.S.'s avatar
Joe T.S. committed
25
    url: "https://steinbeis-3dps.eu/3DGeoVolumes/collections/DenHaag/3dtiles/tileset.json"
Joe's avatar
Joe committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
}))
Cesium.when(tileset.readyPromise).then(function (tileset) {viewer.flyTo(tileset)})
// chroma.scale(['#fafa6e','#2A4858']).mode('lch').colors(6)
function colorByHeight () {
    tileset.style = new Cesium.Cesium3DTileStyle({
        color: {
            conditions: [
                ['${Height} >= 300', 'color("#FF442E")'],
                ['${Height} >= 200', 'color("#FF8000")'],
                ['${Height} >= 100', 'color("#E7A700")'],
                ['${Height} >= 50', 'color("#CFC600")'],
                ['${Height} >= 25', 'color("#A4B600")'],
                ['${Height} >= 10', 'color("#6A9E00")'],
                ['true', 'rgb(127, 59, 8)']
            ]
        }
    });
}