-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·301 lines (238 loc) · 11 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
292
293
294
295
296
297
298
299
300
301
<!DOCTYPE HTML>
<html lang="de">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="preload" href="./fonts/monarg.ttf" as="font" type="font/ttf" crossorigin>
<script src="./[email protected]/leaflet.js"></script>
<link rel="stylesheet" href="./[email protected]/leaflet.css" />
<script src="./leaflet.infoButton@1e41c0b/leaflet.infoButton.js"></script>
<link rel="stylesheet" href="./leaflet.infoButton@1e41c0b/leaflet.infoButton.css" />
<script src='./[email protected]/PruneCluster.js'></script>
<link rel="stylesheet" href="./[email protected]/LeafletStyleSheet.css">
<script src="./[email protected]/leaflet-search.js"></script>
<link rel="stylesheet" href="./[email protected]/leaflet-search.css">
<script src="./[email protected]/Leaflet.fullscreen.min.js"></script>
<link rel="stylesheet" href="./[email protected]/leaflet.fullscreen.css" />
<script src="./[email protected]/L.Control.Locate.min.js" charset="utf-8"></script>
<link rel="stylesheet" href="./[email protected]/L.Control.Locate.min.css" />
<script src="./[email protected]/papaparse.js" charset="utf-8"></script>
<style>
html,
body {
height: 100%;
padding: 0;
margin: 0;
font-family: sans-serif;
}
#map {
width: 100%;
height: 100%;
}
.prunecluster-small {
background-color: #cadf87;
& div {
background-color: #b3dd31;
}
}
.prunecluster-medium {
background-color: #a0a165;
& div {
background-color: #9ea004;
color: white;
}
}
.prunecluster-large {
background-color: #563e34;
& div {
background-color: #532817;
color: white;
}
}
.leaflet-infoWindow {
font-family: sans-serif;
& .leaflet-title {
height: 25%;
max-height: 120px;
padding: 0% 10%;
overflow: hidden;
text-align: center;
}
}
/* .leaflet-infoWindow */
</style>
<style>
@font-face {
font-family: 'Monarg';
src: url('./fonts/monarg.ttf') format('truetype');
}
.vernacular-name {
font-family: 'Monarg', sans-serif;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
// OpenStreetMap
var openStreetMap = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
minZoom: 8,
attribution: '© <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
});
//Ortho imagery 2020
var orthoSouthtyrol2020 = L.tileLayer.wms('https://geoservices.buergernetz.bz.it/mapproxy/p_bz-Orthoimagery/wms?', {
maxZoom: 19,
minZoom: 8,
layers: 'Aerial-2020-RGB',
attribution: 'Map data © <a href="https://geoportal.buergernetz.bz.it/geodaten.asp">Geoportal Südtirol</a>, <a href="https://creativecommons.org/publicdomain/zero/1.0/deed.en">CC-0</a>'
});
// South Tyrol Base map
var mapSouthtyrol = L.tileLayer.wms('https://geoservices.buergernetz.bz.it/mapproxy/root/wms?', {
maxZoom: 19,
minZoom: 8,
layers: 'p_bz-BaseMap:Basemap-Standard',
attribution: 'Map data © <a href="https://geoportal.buergernetz.bz.it/geodaten.asp">Geoportal Südtirol</a>, <a href="https://creativecommons.org/publicdomain/zero/1.0/deed.en">CC-0</a>'
});
var layers = {
'Luftbild 2020 - Ortofotocarta 2020': orthoSouthtyrol2020,
'Basemap mit Straßen und Ortsbezeichnungen - Basemap con strade e toponimi': mapSouthtyrol,
'OpenStreetMap': openStreetMap,
};
// initialize Leaflet
var map = L.map('map', {
preferCanvas: true,
fullscreenControl: true,
renderer: L.canvas(),
layers: [orthoSouthtyrol2020]
}).setView({ lon: 11.5, lat: 46.5 }, 9);
// show the scale bar on the lower left corner
L.control.scale().addTo(map);
// add layers control to top right corner
L.control.layers(layers).addTo(map);
// setup PruneCluster
var pruneCluster = new PruneClusterForLeaflet();
//add info button
var infoButton = L.control.infoButton({
position: 'topleft',
linkTitle: 'More Info', // This changes the link text of the button
title: '<h2>Flurnamen Südtirols <br> I nomi geografici dell Alto Adige</h2>', // This sets the title of the popup box
html: '<p>Die Flurnamen-Datenbank des Naturmuseum Südtirol mit ihren inzwischen 185.000 deutschen, italienischen, ladinischen und alpenromanischen Bezeichnungen. Mehr Infos gibt es <a href="https://www.natura.museum/de/digitalesammlungen/flurnamen/" target="_blank">beim Naturmuseum Südtirol</a>. <br> <br> Am Projekt gearbeitet haben die Fachleute für Flurnamen Johannes Ortner und Cäcilia Wegscheider, Benno Baumgarten vom Naturmuseum als Projektkoordinator, David Colmano vom Landesamt für Landesplanung und Kartografie, Lydia Flöss der Trentiner Landeskommission für Toponomastik sowie Leander Moroder und Silvia Liotto des ladinischen Kulturinstituts Micurà de Rü.<br> <br> Vielen Dank an Martin Meixger und Andreas Baumgartner für die Realisierung dieser Seite. <br> Auszug aus dem Flurnamenkatalog vom 15.03.2024<br><br> Die Daten können unter der Creative Commons Lizenz CC BY-NC-ND 4.0 genutzt werden, siehe https://creativecommons.org/licenses/by-nc-nd/4.0/deed.de <br> <br> La banca dati dei nomi geografici del Museo di Scienze Naturali dell'Alto Adige, che conta ormai 185.000 denominazioni in tedesco, italiano, ladino e romancio alpino. Maggiori informazioni sono disponibili sul sito del Museo di Scienze Naturali dell 'Alto Adige. <br> <br> Al progetto hanno lavorato gli esperti di toponimi Johannes Ortner e Cäcilia Wegscheider, Benno Baumgarten del Museo di Scienze Naturali come coordinatore del progetto, David Colmano dell'Ufficio Provinciale per la Pianificazione Territoriale e la Cartografia, Lydia Flöss della Commissione Provinciale di Toponomastica del Trentino, nonché Leander Moroder e Silvia Liotto dell'Istituto Culturale Ladino Micurà de Rü.<br> <br> Un ringraziamento speciale a Martin Meixger e Andreas Baumgartner per la realizzazione di questo sito.<br><br> Estratto eseguito dal catalogo il 15/03/2024<br>I dati possono essere utilizzati sotto la licenza CC BY-NC-ND 4.0 https://creativecommons.org/licenses/by-nc-nd/4.0/deed.it </p>'
}).addTo(map);
// add "locate" button
L.control.locate().addTo(map);
//this function needs to be defined to read the '<' character in the vernacular names to avoid escaping
function escapeHtml(text) {
return text
.replace(/>/g, ">")
.replace(/</g, "<");
}
//load custom icon
var customIcon = L.icon({
iconUrl: './images/customicon48.png',
iconSize: [24, 36], // Size of the icon
iconAnchor: [12, 36], // Anchor point at the bottom center of the icon
popupAnchor: [0, -36] // Adjust based on where you want the popup to appear
});
// load CSV file
fetch('./database/FN_20240315.csv').then(function (response) {
return response.text();
}).then(function (text) {
var lines = Papa.parse(text).data;
for (var i = 1; i < lines.length; i++) {
var parts = lines[i];
if (parts.length > 1) {
//read names, col1,2,3
let nameDE = parts[0]; // German names
let nameIT = parts[12];
let nameLLD = parts[13];
// Initialize an array to hold the names
let names = [];
// Check if each name is not empty and add it to the array
if (nameDE.trim() !== "") names.push(nameDE);
if (nameIT.trim() !== "") names.push(nameIT);
if (nameLLD.trim() !== "") names.push(nameLLD);
// Join the names with a separator, e.g., a comma and a space
let combinedNames = names.join(", ");
//read vernacular names, col4,5,6,
let vernacular_DE = escapeHtml(parts[1]);
let vernacular_IT = escapeHtml(parts[2]);
let vernacular_OTHER = escapeHtml(parts[11]);
// Initialize an array to hold the vernacularnames
let vernacularnames = [];
// Check if each vernacularname is not empty and add it to the array
if (vernacular_DE.trim() !== "") vernacularnames.push(vernacular_DE);
if (vernacular_IT.trim() !== "") vernacularnames.push(vernacular_IT);
if (vernacular_OTHER.trim() !== "") vernacularnames.push(vernacular_OTHER);
// Join the vernacularnames with a separator, e.g., a comma and a space
let combinedVernacularnames = vernacularnames.join(", ");
//console.log(combinedVernacularnames);
//read latitude and longitude
let lon = parseFloat(parts[parts.length - 1].replace(',', '.'));
let lat = parseFloat(parts[parts.length - 2].replace(',', '.'));
if (Number.isFinite(lon) && Number.isFinite(lat)) {
var marker = new PruneCluster.Marker(lon, lat, {
name: combinedNames,
location: { lon, lat },
vernacular: combinedVernacularnames
});
pruneCluster.RegisterMarker(marker);
}
}
}
// pruneCluster.PrepareLeafletClusterIcon = function (cluster) {
// var markers = cluster.GetClusterMarkers();
// var n = markers.length;
// var icon = new L.DivIcon({
// html: '<div style="background-color: #3399FF; color: #000000; border-radius: 50%; width: 30px; height: 30px; line-height: 30px; text-align: center;">' + n + '</div>',
// className: 'prunecluster leaflet-marker-icon'
// });
// cluster.icon = icon;
// };
pruneCluster.BuildLeafletMarker = function (marker, position) {
// var m = new L.CircleMarker(position, {
// radius: 20,
// weight: 10,
// color: '#b3dd31',
// fillOpacity: 0.5
// });
var m = new L.Marker(position, {
icon: customIcon,
// opacity: .75
});
m.setOpacity = L.Util.falseFn; // a fake setOpacity method#
m.setZIndexOffset = L.Util.falseFn;
this.PrepareLeafletMarker(m, marker.data, marker.category);
return m;
}
pruneCluster.PrepareLeafletMarker = function (marker, data) {
if (marker.preparedLeafletMarker) return;
// marker.bindTooltip(`<strong>${data.name}</strong>`, { permanent: true, interactive: true }).openTooltip();
// marker.bindTooltip(`<strong>${data.name}</strong>`, { permanent: true, interactive: true, direction: 'right' }).openTooltip();
// marker.bindTooltip(`<strong>${data.name}</strong>`, { permanent: true, interactive: true, direction: 'bottom' }).openTooltip();
marker.bindTooltip(`<strong>${data.name}</strong>`, { permanent: true, interactive: true, direction: 'top', offset: [0, -36] }).openTooltip();
let textPopup = `Coordinates (lon,lat): ${data.location.lon},${data.location.lat}`;
if (data.vernacular) textPopup += `<br />Vernacular Name: <span class='vernacular-name'>${data.vernacular}</span>`;
marker.bindPopup(textPopup).openPopup();
marker.preparedLeafletMarker = true;
};
map.addLayer(pruneCluster);
// map.fitBounds(clusteredMarkers.getBounds());
}).then(function () {
controlSearch = new L.control.search({
position: 'topleft',
propertyName: 'data.name',
propertyLoc: 'position',
sourceData: function (test, callback) {
callback(pruneCluster.Cluster._markers);
},
initial: false,
zoom: 16,
firstTipSubmit: true
});
map.addControl(controlSearch);
});
</script>
</body>
</html>