-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
82 lines (73 loc) · 2.77 KB
/
index.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Wayfinder3D</title>
<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>
// Set Bing Maps API key
myKey = "At2y8wTp7i2xyPBsYXYUHrLOk-ZOmQMiT7-JTU140HRP_9exxYuA4DIZIhK_NxzU";
Cesium.BingMapsApi.defaultKey = myKey;
// Initialize viewer
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});
var pinBuilder = new Cesium.PinBuilder();
// Load data
viewer.dataSources.add(Cesium.CzmlDataSource.load('data.czml'));
// Make pins
var startPin = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(-73.99701, 40.73143),
billboard: {
image: pinBuilder.fromColor(Cesium.Color.FORESTGREEN, 48),
verticalOrigin: Cesium.VerticalOrigin.TOP
},
label: {
text: 'Washington Square Park, New York City',
verticalOrigin: Cesium.VerticalOrigin.TOP,
horizontalOrigin: Cesium.HorizontalOrigin.RIGHT,
font: '20px Helvetica',
fillColor: Cesium.Color.WHITE,
outlineWidth: 1,
style: Cesium.LabelStyle.FILL,
pixelOffset: new Cesium.Cartesian2(-25, -25)
}
});
var endPin = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(-73.98127, 40.76899),
billboard: {
image: pinBuilder.fromColor(Cesium.Color.CRIMSON, 48),
verticalOrigin: Cesium.VerticalOrigin.BOTTOM
},
label: {
text: 'Central Park, New York City',
verticalOrigin: Cesium.VerticalOrigin.TOP,
horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
font: '20px Helvetica',
fillColor: Cesium.Color.WHITE,
outlineWidth: 1,
style: Cesium.LabelStyle.FILL,
pixelOffset: new Cesium.Cartesian2(25, -25)
}
});
//Since some of the pins are created asynchronously, wait for them all to load before zooming/
Cesium.when.all([startPin, endPin], function(pins){
viewer.zoomTo(pins);
});
</script>
</body>
</html>