Repository navigation
Expand file tree
/
Copy pathmap.html
More file actions
71 lines (62 loc) · 2.56 KB
/
Copy pathmap.html
File metadata and controls
71 lines (62 loc) · 2.56 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>meteoblue Maps Plugin</title>
<!-- Load the Mapbox GL JS mapping library from meteoblue servers -->
<script
src="https://static.meteoblue.com/cdn/mapbox-gl-js/v1.11.1/mapbox-gl.js"
integrity="sha512-v5PfWsWi47/AZBVL7WMNqdbM1OMggp9Ce408yX/X9wg87Kjzb1xqpO2Ul0Oue8Vl9kKOcwPM2MWWkTbUjRxZOg=="
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="https://static.meteoblue.com/cdn/mapbox-gl-js/v1.11.1/mapbox-gl.css"
integrity="sha512-xY1TAM00L9X8Su9zNuJ8nBZsGQ8IklX703iq4gWnsw6xCg+McrHXEwbBkNaWFHSqmf6e7BpxD6aJQLKAcsGSdA=="
crossorigin="anonymous"
/>
<!-- Load the meteoblue Maps Plugin -->
<script src="https://static.meteoblue.com/lib/maps-plugin/v0.x/maps-plugin.js"></script>
<style>
#mapContainer {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>
</head>
<body>
<div id="mapContainer"></div>
<script>
// Rate-limited demo API key. Will be replaced from time to time. Do not use.
// Get an API key here: https://content.meteoblue.com/en/access-options/meteoblue-weather-api
const apiKey = "be72f76237db";
const lang = "en";
// Maps shown in the menu. The first one is shown initially.
// For all available maps, see https://maps-api.meteoblue.com/v1/map/inventory/redoc
const maps = "temperature,windAnimation,cloudsAndPrecipitation,radar,satellite";
// Initialize the Mapbox GL JS map inside the mapContainer element.
// Do not set the style parameter. It will be overwritten by the meteoblue Maps Plugin.
const mapboxMap = new mapboxgl.Map({
container: "mapContainer",
center: [7, 47],
zoom: 4,
attributionControl: false,
keyboard: false,
});
// The URL to the Inventory JSON. In this case the meteoblue API will generate one with the specified maps.
const inventoryUrl = `https://maps-api.meteoblue.com/v1/map/inventory/filter?lang=${lang}&maps=${maps}&apikey=${apiKey}`;
// Initialize the meteoblue Maps Plugin. It will generate a user interface on top of the
// Mapbox GL JS map according to the Inventory JSON.
// All options: https://docs.meteoblue.com/en/weather-apis/maps-api/maps-plugin
new meteoblueMapsPlugin({
mapboxMap: mapboxMap,
inventory: inventoryUrl,
apiKey: apiKey,
});
</script>
</body>
</html>