-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
291 lines (287 loc) · 11.9 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
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="css/leaflet.css">
<link rel="stylesheet" href="css/qgis2web.css"><link rel="stylesheet" href="css/fontawesome-all.min.css">
<link rel="stylesheet" href="css/leaflet-measure.css">
<style>
html, body, #map {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
</style>
<title></title>
</head>
<body>
<div id="map">
</div>
<script src="js/qgis2web_expressions.js"></script>
<script src="js/leaflet.js"></script>
<script src="js/leaflet.rotatedMarker.js"></script>
<script src="js/leaflet.pattern.js"></script>
<script src="js/leaflet-hash.js"></script>
<script src="js/Autolinker.min.js"></script>
<script src="js/rbush.min.js"></script>
<script src="js/labelgun.min.js"></script>
<script src="js/labels.js"></script>
<script src="js/leaflet-measure.js"></script>
<script src="data/1897_3.js"></script>
<script src="data/2022_4.js"></script>
<script src="data/1911_5.js"></script>
<script>
var highlightLayer;
function highlightFeature(e) {
highlightLayer = e.target;
if (e.target.feature.geometry.type === 'LineString') {
highlightLayer.setStyle({
color: '#ffff00',
});
} else {
highlightLayer.setStyle({
fillColor: '#ffff00',
fillOpacity: 1
});
}
highlightLayer.openPopup();
}
var map = L.map('map', {
zoomControl:true, maxZoom:20, minZoom:7
})
var hash = new L.Hash(map);
map.attributionControl.setPrefix('<a href="https://github.com/tomchadwin/qgis2web" target="_blank">qgis2web</a> · <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a> · <a href="https://qgis.org">QGIS</a>');
var autolinker = new Autolinker({truncate: {length: 30, location: 'smart'}});
var measureControl = new L.Control.Measure({
position: 'topleft',
primaryLengthUnit: 'meters',
secondaryLengthUnit: 'kilometers',
primaryAreaUnit: 'sqmeters',
secondaryAreaUnit: 'hectares'
});
measureControl.addTo(map);
document.getElementsByClassName('leaflet-control-measure-toggle')[0]
.innerHTML = '';
document.getElementsByClassName('leaflet-control-measure-toggle')[0]
.className += ' fas fa-ruler';
var bounds_group = new L.featureGroup([]);
function setBounds() {
if (bounds_group.getLayers().length) {
map.fitBounds(bounds_group.getBounds());
}
map.setMaxBounds(map.getBounds());
}
map.createPane('pane_GoogleTerrain_0');
map.getPane('pane_GoogleTerrain_0').style.zIndex = 400;
var layer_GoogleTerrain_0 = L.tileLayer('https://mt1.google.com/vt/lyrs=p&x={x}&y={y}&z={z}', {
pane: 'pane_GoogleTerrain_0',
opacity: 1.0,
attribution: '<a href="https://www.google.at/permissions/geoguidelines/attr-guide.html">Map data ©2015 Google</a>',
minZoom: 7,
maxZoom: 20,
minNativeZoom: 0,
maxNativeZoom: 20
});
layer_GoogleTerrain_0;
map.addLayer(layer_GoogleTerrain_0);
map.createPane('pane_GoogleSatellite_1');
map.getPane('pane_GoogleSatellite_1').style.zIndex = 401;
var layer_GoogleSatellite_1 = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
pane: 'pane_GoogleSatellite_1',
opacity: 1.0,
attribution: '<a href="https://www.google.at/permissions/geoguidelines/attr-guide.html">Map data ©2015 Google</a>',
minZoom: 7,
maxZoom: 20,
minNativeZoom: 0,
maxNativeZoom: 20
});
layer_GoogleSatellite_1;
map.addLayer(layer_GoogleSatellite_1);
map.createPane('pane_MouthofRioGrande_modified_2');
map.getPane('pane_MouthofRioGrande_modified_2').style.zIndex = 402;
var img_MouthofRioGrande_modified_2 = 'data/MouthofRioGrande_modified_2.png';
var img_bounds_MouthofRioGrande_modified_2 = [[25.927635438352862,-97.22465888573008],[25.992947513239724,-97.12851114219315]];
var layer_MouthofRioGrande_modified_2 = new L.imageOverlay(img_MouthofRioGrande_modified_2,
img_bounds_MouthofRioGrande_modified_2,
{pane: 'pane_MouthofRioGrande_modified_2'});
bounds_group.addLayer(layer_MouthofRioGrande_modified_2);
map.addLayer(layer_MouthofRioGrande_modified_2);
function pop_1897_3(feature, layer) {
layer.on({
mouseout: function(e) {
for (i in e.target._eventParents) {
e.target._eventParents[i].resetStyle(e.target);
}
if (typeof layer.closePopup == 'function') {
layer.closePopup();
} else {
layer.eachLayer(function(feature){
feature.closePopup()
});
}
},
mouseover: highlightFeature,
});
var popupContent = '<table>\
<tr>\
<th scope="row">1897</th>\
<td>' + (feature.properties['1897'] !== null ? autolinker.link(feature.properties['1897'].toLocaleString()) : '') + '</td>\
</tr>\
</table>';
layer.bindPopup(popupContent, {maxHeight: 400});
}
function style_1897_3_0() {
return {
pane: 'pane_1897_3',
opacity: 1,
color: 'rgba(229,182,54,1.0)',
dashArray: '',
lineCap: 'round',
lineJoin: 'round',
weight: 14.0,
fillOpacity: 0,
interactive: true,
}
}
map.createPane('pane_1897_3');
map.getPane('pane_1897_3').style.zIndex = 403;
map.getPane('pane_1897_3').style['mix-blend-mode'] = 'normal';
var layer_1897_3 = new L.geoJson(json_1897_3, {
attribution: '',
interactive: true,
dataVar: 'json_1897_3',
layerName: 'layer_1897_3',
pane: 'pane_1897_3',
onEachFeature: pop_1897_3,
style: style_1897_3_0,
});
bounds_group.addLayer(layer_1897_3);
map.addLayer(layer_1897_3);
function pop_2022_4(feature, layer) {
layer.on({
mouseout: function(e) {
for (i in e.target._eventParents) {
e.target._eventParents[i].resetStyle(e.target);
}
if (typeof layer.closePopup == 'function') {
layer.closePopup();
} else {
layer.eachLayer(function(feature){
feature.closePopup()
});
}
},
mouseover: highlightFeature,
});
var popupContent = '<table>\
<tr>\
<th scope="row">2022</th>\
<td>' + (feature.properties['2022'] !== null ? autolinker.link(feature.properties['2022'].toLocaleString()) : '') + '</td>\
</tr>\
</table>';
layer.bindPopup(popupContent, {maxHeight: 400});
}
function style_2022_4_0() {
return {
pane: 'pane_2022_4',
opacity: 1,
color: 'rgba(31,120,180,1.0)',
dashArray: '',
lineCap: 'round',
lineJoin: 'round',
weight: 14.0,
fillOpacity: 0,
interactive: true,
}
}
map.createPane('pane_2022_4');
map.getPane('pane_2022_4').style.zIndex = 404;
map.getPane('pane_2022_4').style['mix-blend-mode'] = 'normal';
var layer_2022_4 = new L.geoJson(json_2022_4, {
attribution: '',
interactive: true,
dataVar: 'json_2022_4',
layerName: 'layer_2022_4',
pane: 'pane_2022_4',
onEachFeature: pop_2022_4,
style: style_2022_4_0,
});
bounds_group.addLayer(layer_2022_4);
map.addLayer(layer_2022_4);
function pop_1911_5(feature, layer) {
layer.on({
mouseout: function(e) {
for (i in e.target._eventParents) {
e.target._eventParents[i].resetStyle(e.target);
}
if (typeof layer.closePopup == 'function') {
layer.closePopup();
} else {
layer.eachLayer(function(feature){
feature.closePopup()
});
}
},
mouseover: highlightFeature,
});
var popupContent = '<table>\
<tr>\
<th scope="row">1911</th>\
<td>' + (feature.properties['1911'] !== null ? autolinker.link(feature.properties['1911'].toLocaleString()) : '') + '</td>\
</tr>\
</table>';
layer.bindPopup(popupContent, {maxHeight: 400});
}
function style_1911_5_0() {
return {
pane: 'pane_1911_5',
opacity: 1,
color: 'rgba(51,160,44,1.0)',
dashArray: '',
lineCap: 'round',
lineJoin: 'round',
weight: 14.0,
fillOpacity: 0,
interactive: true,
}
}
map.createPane('pane_1911_5');
map.getPane('pane_1911_5').style.zIndex = 405;
map.getPane('pane_1911_5').style['mix-blend-mode'] = 'normal';
var layer_1911_5 = new L.geoJson(json_1911_5, {
attribution: '',
interactive: true,
dataVar: 'json_1911_5',
layerName: 'layer_1911_5',
pane: 'pane_1911_5',
onEachFeature: pop_1911_5,
style: style_1911_5_0,
});
bounds_group.addLayer(layer_1911_5);
map.addLayer(layer_1911_5);
var baseMaps = {};
L.control.layers(baseMaps,{'<img src="legend/1911_5.png" /> 1911': layer_1911_5,'<img src="legend/2022_4.png" /> 2022': layer_2022_4,'<img src="legend/1897_3.png" /> 1897': layer_1897_3,"Mouth of Rio Grande_modified": layer_MouthofRioGrande_modified_2,"Google Satellite": layer_GoogleSatellite_1,"Google Terrain": layer_GoogleTerrain_0,},{collapsed:false}).addTo(map);
setBounds();
L.ImageOverlay.include({
getBounds: function () {
return this._bounds;
}
});
resetLabels([layer_1897_3,layer_2022_4,layer_1911_5]);
map.on("zoomend", function(){
resetLabels([layer_1897_3,layer_2022_4,layer_1911_5]);
});
map.on("layeradd", function(){
resetLabels([layer_1897_3,layer_2022_4,layer_1911_5]);
});
map.on("layerremove", function(){
resetLabels([layer_1897_3,layer_2022_4,layer_1911_5]);
});
</script>
</body>
</html>