-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
88 lines (77 loc) · 2.62 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
83
84
85
86
87
88
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>OSM 3D Globe Demo</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.11.1/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.11.1/mapbox-gl.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
const basemapEnum = "OSM:Standard";
const ARCGISapikey = "ARCGIS_API_KEY" // <-- replace with your own
// Get ESRI ARCGIS api key at https://developers.arcgis.com/sign-up/
const osmStyle = `https://basemaps-api.arcgis.com/arcgis/rest/services/styles/${basemapEnum}?type=style&token=${ARCGISapikey}`;
// TO MAKE THE MAP APPEAR YOU MUST
// ADD YOUR ACCESS TOKEN FROM
// https://account.mapbox.com
mapboxgl.accessToken = "MAPBOX_ACCESS_TOKEN"; // <-- replace with your own
const map = new mapboxgl.Map({
container: 'map',
style: osmStyle,//'mapbox://styles/mapbox/satellite-streets-v11',
zoom: 1.5,
center: [30, 50],
projection: 'globe'
});
map.on('load', () => {
// Set the default atmosphere style
map.setFog({
color: "#333333", // Lower atmosphere
'high-color': "#000000", // Upper atmosphere
'horizon-blend': [
"interpolate",
["linear"],
["zoom"],
4,
0.01,
7,
0.5
], // Atmosphere thickness (default 0.2 at low zooms)
'space-color': "#000000", // Background color
'star-intensity': [
"interpolate",
["linear"],
["zoom"],
5,
0.35,
6,
0
]
});
if (!map.getSource("mapbox-dem")) {
map.addSource("mapbox-dem", {
type: "raster-dem",
url: "mapbox://mapbox.mapbox-terrain-dem-v1",
tileSize: 512,
maxzoom: 14,
});
}
map.setTerrain({ source: "mapbox-dem", exaggeration: 1.5 });
});
</script>
</body>
</html>