-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapa_dustee2.htm
168 lines (139 loc) · 7.44 KB
/
mapa_dustee2.htm
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<title>dustee map</title>
<!-- Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=""></script>
<!-- CDN -->
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/geotiff.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.0/chroma.min.js"></script>
<!-- Plugin -->
<script src="https://ihcantabria.github.io/Leaflet.CanvasLayer.Field/dist/leaflet.canvaslayer.field.js"></script>
<style>
body { margin:0; padding:0; }
body, table, tr, td, th, div, h1, h2, input { font-family: "Calibri", "Trebuchet MS", "Ubuntu", Serif; font-size: 11pt; }
.ctl {
padding: 2px 10px 2px 10px;
background: white;
background: rgba(255,255,255,0.9);
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
text-align: right;
}
.title {
font-size: 18pt;
font-weight: bold;
}
.src {
font-size: 10pt;
}
</style>
</head>
<body>
<div id="map" style="width: 600px; height: 400px;"></div>
<script src="data/meta.no2"></script>
<script src="data/meta.aerosols"></script>
<script>
/* **** Leaflet **** */
// WMS of CAMS:
//var tokenCAMS = "__D9NMBOku6bl15FJvOBYRfSLBZ5k2Mnyf__";
//var CAMS_pm = "https://geoservices.regional.atmosphere.copernicus.eu/services/CAMS50-ENSEMBLE-FORECAST-01-EUROPE-WMS?&service=WMS&VERSION=1.3.0&LAYERS=PM10__SPECIFIC_HEIGHT_LEVEL_ABOVE_GROUND&STYLES=PM10_USI__HEIGHT__SHADING&DIM_REFERENCE_TIME=2019-10-23T00:00:00Z&TIME=2019-10-23T00:00:00Z&ELEVATION=0&FORMAT=image/png&
//TOKEN=__D9NMBOku6bl15FJvOBYRfSLBZ5k2Mnyf__&REQUEST=GetMap&CRS=EPSG:4326&BBOX=30.05,-24.95,71.95,44.95&WIDTH=810&HEIGHT=495";
//var source = L.WMS.source(CAMS_pm, {
// 'transparent': true
//});
// source.getLayer("layer1").addTo(map);
// Tile mode (Uses L.WMS.TileLayer)
//var s = L.WMS.source("http://example.com/mapserv", {
// 'transparent': true,
// 'tiled': true
//});
// Base layers
// .. OpenStreetMap
var osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors', minZoom: 6, maxZoom: 9});
// .. CartoDB Positron
// var cartodb = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>', minZoom: 6, maxZoom: 9});
// .. OSM Toner
// var toner = L.tileLayer('http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png', {attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.', minZoom: 6, maxZoom: 9});
// .. White background
// var white = L.tileLayer("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEX///+nxBvIAAAAH0lEQVQYGe3BAQ0AAADCIPunfg43YAAAAAAAAAAA5wIhAAAB9aK9BAAAAABJRU5ErkJggg==", {minZoom: 6, maxZoom: 9});
var mapbox_sat = L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
minZoom: 6, maxZoom: 9,
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox.satellite'
});
// Overlay layers (TMS)
var lyr = L.tileLayer('data/no2/{z}/{x}/{y}.png', {tms: true, opacity: 0.4, attribution: "(c)2019 Milan Lazecky pro dustee", minZoom: 6, maxZoom: 9});
var lyr2 = L.tileLayer('data/aerosols/{z}/{x}/{y}.png', {tms: true, opacity: 0.4, attribution: "(c)2019 Milan Lazecky pro dustee", minZoom: 6, maxZoom: 9});
d3.request("no2.tif").responseType('arraybuffer').get(
function (error, tiffData) {
let hodnota = L.ScalarField.fromGeoTIFF(tiffData.response);
let layer = L.canvasLayer.scalarField(hodnota, {
opacity: 0
}).addTo(map);
layer.on('click', function (e) {
if (e.value !== null) {
let v = e.value.toFixed(2);
let html = (`<span class="popupText">NO2 ${v} mol/cm^2</span>`);
let popup = L.popup()
.setLatLng(e.latlng)
.setContent(html)
.openOn(map);
}
});
map.fitBounds(layer.getBounds());
});
// Map
var map = L.map('map', {
center: [49.64444467891838, 15.669143802785019],
zoom: 9,
minZoom: 6,
maxZoom: 9,
layers: [osm, lyr]
});
map.setView([49.64444467891838, 15.669143802785019], 6);
var marker = L.marker([49.2787598, 17.3866845]).addTo(map);
marker.bindPopup("MS Osvoboditelu 99<br />Kromeriz"); //.openPopup();
// var basemaps = {"OpenStreetMap": osm, "CartoDB Positron": cartodb, "Stamen Toner": toner, "Without background": white}
var basemaps = {"OpenStreetMaps": osm, "MapBoxSat": mapbox_sat}
var overlaymaps = {"Sentinel-5P NO2": lyr, "Sentinel-5P Aerosol": lyr2}
// Title
var title = L.control();
title.onAdd = function(map) {
this._div = L.DomUtil.create('div', 'ctl title');
this.update();
return this._div;
};
title.update = function(props) {
this._div.innerHTML = textno2;
};
title.addTo(map);
// Note
var src = 'NO2 hodnoty 0-0.5 mol/cm-2, Aerosol: -1,1';
var title = L.control({position: 'bottomleft'});
title.onAdd = function(map) {
this._div = L.DomUtil.create('div', 'ctl src');
this.update();
return this._div;
};
title.update = function(props) {
this._div.innerHTML = src;
};
title.addTo(map);
// Add base layers
L.control.layers(basemaps, overlaymaps, {collapsed: false}).addTo(map);
// Fit to overlay bounds (SW and NE points with (lat, lon))
// map.fitBounds([[47.804189357836755, 19.95158760557004], [51.48470000000001, 11.3867]]);
</script>
</body>
</html>