forked from CartoDB/labs-cesiumjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tornados.html
65 lines (63 loc) · 2.84 KB
/
tornados.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>CartoDB - Cesium example (tornados)</title>
<link href="//cartodb-libs.global.ssl.fastly.net/cartodbui/assets/3.4.9/favicons/favicon.ico?1411985985" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<script src="Cesium/Cesium.js"></script>
<style>
@import url(Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.core.js"></script>
<script src="cesium-cartodb.min.js"></script>
<script>
// Basemap
var basemapProvider = new Cesium.CartoDBImageryProvider({
url: 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
credit: 'Basemap courtesy of CartoDB'
});
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProvider: basemapProvider,
baseLayerPicker: false,
fullscreenButton: false,
homeButton: false,
timeline: false,
navigationHelpButton: false,
animation: false,
scene3DOnly: true,
geocoder: false
});
// Tile data layer
var layerData = {
user_name: 'cartotraining',
maps_api_template: 'https://{user}.cartodb.com', // Optional
sublayers: [{
sql: "SELECT * FROM tornado",
cartocss: '#tornados{ marker-fill: #FFCC00; marker-width: 8; marker-line-color: #FFF; marker-line-width: 1.5; marker-line-opacity: 1; marker-fill-opacity: 0.9; marker-comp-op: multiply; marker-type: ellipse; marker-placement: point; marker-allow-overlap: true; marker-clip: false; marker-multi-policy: largest;}'
}]
};
cartodb.Tiles.getTiles(layerData, function (tiles, err) {
if (tiles == null) {
console.log("error: ", err.errors.join('\n'));
return;
}
viewer.scene.imageryLayers.addImageryProvider(new Cesium.CartoDBImageryProvider({
url: tiles.tiles[0],
credit: 'Tornado data courtesy of CartoDB'
}));
});
</script>
</body>
</html>