-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
executable file
·66 lines (60 loc) · 1.99 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
<html lang="en">
<head>
<meta charset="utf-8">
<title> Altizure SDK offline demo </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
</head>
<body style="margin: 0px; padding: 0px;">
<div id="page-content"></div>
<script type="text/javascript" src="public/js/altizure.min.js"></script>
<script>
let options = {
altizureApi: {
key: '7MkQf8UggsPaadvrlKALspJWZejZAJOLHn3cnIy'
},
camera: {
center: { "lng": 113.94415847977668, "lat": 22.537916491624586, "alt": 195, "north": 0, "tilt": 52, "up": 0 }
},
renderItems: {
earth: false, // earth globe
orbitRing: false // earth orbit ring
}
}
let sandbox = new altizure.Sandbox('page-content', options)
// You can change to your own PID
const API_INFO_PATH = '/public/data/5e4b996a644d92218b47e373/apiinfo-5e4b996a644d92218b47e373.json'
let spec
let marker
// request your project apiinfo json file here.
fetch(API_INFO_PATH)
.then(res => {
return res.json()
})
.then(apiJson => {
replaceWithDefaultHost(apiJson)
return altizure.altizureSpecWithApiInfo(apiJson)
})
.then(res => {
console.log('spec', JSON.stringify(res))
spec = res
// create marker with the modified spec
marker = new altizure.AltizureProjectMarker({
sandbox: sandbox,
spec: spec,
countryName: 'China',
pose: {
position: { lng: 113.9442, lat: 22.5367, alt: 200 } // with an arbitrary position (longitude, latitude, altitude)
}
})
return marker.initialized
})
.then(m => {
m.focus()
})
function replaceWithDefaultHost (api_json) {
if (!api_json.cloudPath || api_json.cloudPath.length === 0) return
api_json.cloudPath[0].dataUrl = api_json.cloudPath[0].dataUrl.replace('<REPLACE_WITH_YOUR_HOSTNAME_PORT>', 'localhost:8000')
}
</script>
</body>
</html>