-
Notifications
You must be signed in to change notification settings - Fork 14
/
basic.html
63 lines (57 loc) · 1.97 KB
/
basic.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Wind Animation Google Maps</title>
<script src="./../../dist/windable.min.js" defer></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.24" defer></script>
<script src="./examples/googleMaps/canvasLayer.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.min.js" defer></script>
<style>
html, body, #google-map-canvas {
width: 100%;
height: 100%;
margin: 0;
padding: 0 0 0 0;
}
</style>
</head>
<body>
<div id="google-map-canvas"></div>
<script type="text/javascript">
window.onload = function() {
// Initialize the map.
const element = document.getElementById('google-map-canvas');
const map = new google.maps.Map(element, {
zoom: 3,
center: new google.maps.LatLng(39.3, -45.8),
styles: [
{featureType: 'water', stylers: [{ color: '#ffffff'}]},
{featureType: 'poi', stylers: [{visibility: 'off'}]}
]
});
const windMap = new WindMap({
canvas: new CanvasLayer({map: map}).canvas,
extent: () => {
return {
width: element.clientWidth,
height: element.clientHeight,
latlng:[
[map.getBounds().j.j, map.getBounds().H.H],
[map.getBounds().j.H, map.getBounds().H.j]
]
};
}
});
['bounds_changed', 'resize'].forEach(listener => {
map.addListener(listener, windMap.update.bind(windMap));
});
// Fetch data for 700 millibars.
const mapDataUrl = 'https://raw.githubusercontent.com/dannycochran/windable/master/data/2016040900_700.json'
d3.json(mapDataUrl, (err, windData) => {
windMap.update({data: windData});
});
};
</script>
</body>
</html>