├── .gitignore ├── .gitattributes ├── public ├── resources │ ├── images │ │ ├── layers.png │ │ ├── layers-2x.png │ │ ├── marker-icon.png │ │ ├── marker-shadow.png │ │ └── marker-icon-2x.png │ ├── gps-arrow.php │ ├── leaflet.css │ ├── arrow.js │ └── leaflet.js └── aml.php ├── package.json ├── config ├── config.php └── app_cfg.js ├── README.md ├── app.js └── LICENSE.md /.gitignore: -------------------------------------------------------------------------------- 1 | _bkp/ -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /public/resources/images/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robert-112/AML_Auswerter/HEAD/public/resources/images/layers.png -------------------------------------------------------------------------------- /public/resources/images/layers-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robert-112/AML_Auswerter/HEAD/public/resources/images/layers-2x.png -------------------------------------------------------------------------------- /public/resources/images/marker-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robert-112/AML_Auswerter/HEAD/public/resources/images/marker-icon.png -------------------------------------------------------------------------------- /public/resources/images/marker-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robert-112/AML_Auswerter/HEAD/public/resources/images/marker-shadow.png -------------------------------------------------------------------------------- /public/resources/images/marker-icon-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robert-112/AML_Auswerter/HEAD/public/resources/images/marker-icon-2x.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aml-decoder", 3 | "version": "1.5.0", 4 | "description": "Script zur Anfrage von AML-Daten", 5 | "main": "app.js", 6 | "dependencies": { 7 | "console-stamp": "^0.2.9", 8 | "hex2ascii": "^0.0.3", 9 | "request": "^2.88.0" 10 | }, 11 | "devDependencies": {}, 12 | "scripts": { 13 | "test": "echo \"Error: no test specified\" && exit 1" 14 | }, 15 | "keywords": [ 16 | "aml", 17 | "notruf", 18 | "112" 19 | ], 20 | "author": "Robert Richter", 21 | "license": "CC-BY-4.0" 22 | } -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/resources/gps-arrow.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/app_cfg.js: -------------------------------------------------------------------------------- 1 | var app_cfg = {}; 2 | 3 | app_cfg = { 4 | udp_port: 5432, // UDP-Port 5 | multicast_addr: "192.168.2.1", // Adresse des Multicast-Servers, welcher die Anrufdaten übermittelt 6 | issi: [{ 7 | "issi": 1234567 8 | }, 9 | { 10 | "issi": 1234568 11 | }, 12 | { 13 | "issi": 1234569 14 | }, 15 | { 16 | "issi": 1234560 17 | } 18 | ], // Liste der Geärte für Kartendarstellung 19 | kanalnummer_min: 7, // geringste Kanalnummer auf der ein Anruf eingehen kann, Wert -1 20 | kanalnummer_max: 25, // maximale Kanalnummer auf der ein Anruf eingehen kann, Wert +1 21 | vorwahlfilter: "03", // Anrufe mit dieser Vorwahl werden nicht abgefragt 22 | aml_url: "https://aml-daten.irgendwas.com:1234/hilfe/daten?", // URL der AML-Adresse 23 | aml_port: 443, // Port des AML-Servers 24 | aml_auth_user: "benuzter", // Benutzername 25 | aml_auth_pass: "passwort", //Kennwort 26 | aml_cert: "/var/notrufdaten-certifikat.pem", // Speicherort des notwendigen Zertifkats 27 | aml_key: "/var/notrufdaten-ssl.pem", // Speicherort des notwendigen Zertifkats 28 | aml_passphrase: "1234567890", // SSL-Key 29 | aml_ca: "/var/ca-certificates.crt", // CA 30 | proxy: "http://192.168.1.20:80", // Proxy, sofern genutzt 31 | location_accuracy_max: 51, // max Genauigkeit in Metern 32 | status_url: "http://192.168.2.50:8081", // Adresse des Web-Servers der Status-Telegramme empfängt 33 | status_port: 8069, // Port des Web-Servers der Status-Telegramme empfängt 34 | status_fms_1: [ 35 | '', 36 | '1' 37 | ], // Status 1 38 | status_fms_2: [ 39 | '', 40 | '2' 41 | ], // Status 2 42 | status_position: [ 43 | '', 44 | '', 45 | '', 46 | '' 47 | ] // GPS-Position 48 | }; 49 | 50 | module.exports = app_cfg; 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AML-Decoder 2 | Readme und PHP-Version am 22.10.2019 aktualisiert 3 | 4 | ## Beschreibung 5 | Mit dieser Anwendung können AML-Daten ([Advanced Mobile Location)](https://de.wikipedia.org/wiki/Advanced_Mobile_Location) angefragt und verarbeitet werden. Zur Abfrage der Daten sind Zugangsdaten notwendig, die nur an 112-Leitstellen vergeben werden. 6 | 7 | **_Für die Funktionalität der Software wird keinerlei Haftung übernommen. Auch für Schäden an Systemen Dritter wird keinerlei Haftung übernommen. 8 | Die Nutzung erfolgt ohne Zwang und auf eigene Gefahr._** 9 | 10 | ## Funktionsumfang 11 | Dieses Repository besteht aus zwei Teilen: 12 | 13 | ### A) Webseite zur Anzeige der AML-Daten 14 | Über eine PHP-Webseite können AML-Daten für eine Telefonnummer abgefragt werden. 15 | Das Ergebnis wird in einer Karte im Browser dargestellt. 16 | ![AML über Webseite](https://user-images.githubusercontent.com/19272095/67205616-5ee17a00-f410-11e9-8b5c-5aefdd651def.png) 17 | 18 | ### B) System zur automatischen Abfrage der AML-Daten 19 | Das automatische Abrufen der Daten erfolgt über eine Auswertung der Notrufnummer beim Klingeln und ist optional (also zusätzlich zur Variante A, die Variante B muss nicht genutzt werden). Danach erfolgt eine Weitergabe der AML-Positionsdaten (soforn vorhanden) an andere Systeme (z.B. das Kartenmodul des Einsatzleitsystems). Diese Version wurde bisher nur im Land Brandenburg erfolgreich umgesetzt. 20 | ![autmoatische Darstellung im Drittsystem](https://user-images.githubusercontent.com/19272095/67206072-3c9c2c00-f411-11e9-8410-b60b3bd8cd32.png) 21 | 22 | ## Installation & Konfiguration 23 | 1. Installation eines Linux-Servers (Debian, Ubuntu etc.) 24 | (Windows ist theoretisch auch möglich, wurde aber nie getestet) 25 | 2. Schaffen der Netz-Infrastruktur (IP-Verbindung, ggf. DMZ und Proxy) 26 | 3. Installation der notwendigen Pakete 27 | - für **Variante A** (PHP-Webseite): 28 | Webserver installieren, z.B. [Apache](https://httpd.apache.org/) oder vergleichbar (z.B. Ngnix), prüfen ob notwendige Pakte zum Ausführen von Curl installiert sind (Curl für das Linux-System und für den Web-Server) 29 | - für _Variante B_ (automatisches Abfragen, wird nicht zwingend benötigt) 30 | Installation von [Node.js](https://nodejs.org/) (Version 8 oder höher) 31 | 5. Download des Quellcodes ([Master](https://github.com/Robert-112/AML_Auswerter/archive/master.zip)) 32 | 6. Entpacken der *.zip-Datei 33 | 7. Die Konfigurations-Dateien anpassen und Datein verschieben 34 | - **für Variante A (PHP-Webseite)**: 35 | config.php anpassen; aml.php und config/config.php in das Verzeichnis des Webservers kopieren 36 | - _für Variante B (automatisches Abfragen)_: 37 | app_cfg.js anpassen 38 | 8. Anwendung starten: 39 | - **für Variante A (PHP-Webseite)**: 40 | Webserver starten und nach http://ip-das-servers:port/verzeichnis/aml.php?telefon= navigieren 41 | - _für Variante B (automatisches Abfragen)_: 42 | Komandozeile öffnen (Terminal, SSH etc.) und in das Verzeichnis mit der Datei app.js wechseln. Dort folgende Befehle eingeben: 43 | - `npm install` (lädt und installiert alle Pakete) 44 | - `npm start` (startet die Anwendung) 45 | - *optional:* forever-service (https://www.npmjs.com/package/forever-service) installieren und app.js als Service einbinden 46 | 47 | ## Häufige Fragen (FAQ) 48 | 49 | ### Wie kann ich testen ob mein AML-Zugang funktioniert 50 | Auf dem Server den Testbefehl der AML-Spezifikation ausführen (siehe Dokument der Leitstelle Freiburg -> Curl-Skript). 51 | 52 | ### Wie kann ich das AML-Zertifikat in ein pem-Zertifikat umwandeln und dann aufteilen? 53 | 54 | 1. Zertifkat umwandeln: 55 | 56 | ```$ sudo openssl pkcs12 -in zertifikatsdatei_alt.p12 -out zertifikatsdatei_neu.pem -nodes``` 57 | 58 | 2. Key aus Zertifikat erhalten: 59 | 60 | ```$ sudo openssl pkey -in zertifikatsdatei_neu.pem -out zertifikatsdatei_neu-key.pem``` 61 | 62 | ### Die PHP-Webseite zeigt nichts an, wass kann ich tun? 63 | 64 | 1. Sind alle notwendigen Erweiterungen für den Webserver installiert? 65 | 66 | PHP, Curl etc. 67 | (oftmals fehlt php-curl ```$sudo apt-get install php-curl```) 68 | 69 | 2. Was sagen die Log-Dateien? 70 | 71 | Zunächst sollten Sie die PHP-Log-Dateien prüfen, bzw. aktivieren (siehe: [Where are the apache and php log files?](https://askubuntu.com/questions/14763/where-are-the-apache-and-php-log-files)). 72 | 73 | Unter Ubuntu finden sich die Log-Dateien unter ```/var/log/apache/access.log``` 74 | 75 | 3. Sind die Zertifkate OK? 76 | 77 | Sind die Zertifkate richtig umgewandelt? (siehe oben) 78 | Sind die Zertifkate durch den Webserver lesbar? Testweise kann die Berechtigung für das Zertifkat angepasst werden: 79 | 80 | ```$ sudo chmod 777 zertifkat.pem``` 81 | 82 | ### Wie gebe ich eine Telefonnummer in der Webseite ein? 83 | Dies erfolgt aktuell über einen Paramater beim aufrufen der Webseite http://ip-das-servers:port/verzeichnis/aml.php?telefon=0123456789 84 | 85 | ## Beispiel-Konfiguration der Webseite (PHP-Script -> config.php) 86 | ```$curl_url = "https://aml-daten.irgendwas.com:1234/hilfe/daten?telefon=";``` // URL der AML-Adresse inkl. paramter zur Abfrage (siehe Spezifikation von Freiburg) 87 | 88 | ```$curl_proxy = "192.168.1.80:80";``` // IP:Port des Proxy-Servers, sofern vorhanden, sonst einfach leer lassen 89 | 90 | ```$curl_port = 1234;``` // Port des AML-Servers (siehe Port in der o.g. URL) 91 | 92 | ```$curl_sslcert = "/var/notrufdaten-zertifikat.pem";``` // Speicherort des notwendigen Zertifkats 93 | 94 | ```$curl_sslkey = "/var/notrufdaten-zertifikat-ssl.pem";``` // Speicherort des notwendigen Zertifkats 95 | 96 | ```$curl_sslkeypasswd = "1234567890";``` // SSL-Passwort (wird vom AML-Betreiber mitgeteilt) 97 | 98 | ```$curl_cainfo = "/etc/ssl/certs/ca-certificates.crt";``` // lokales CA-Zertifikat des Linux-Systems 99 | 100 | ```$curl_userpwd = "benutzer:passwort";``` // Benutzer und Passwort für mit : getrennt 101 | 102 | ```$tile_layer = "https://a.tile.openstreetmap.de/{z}/{x}/{y}.png";``` // Eigener Tile-Server für Kartendarstellung 103 | 104 | ## Beispiel des automatischen Abrufs (NodeJS) 105 | ``` 106 | [2019-08-02 17:00:10.678] [INFO] UDP Server auf 0.0.0.0:1554 gestartet. PID: 12569 107 | [2019-08-02 17:03:18.169] [LOG] Notruf auf Kanal 4 erkannt. Rufnummer: 015123456789 108 | [2019-08-02 17:03:19.880] [LOG] Frage AML-Daten für Rufnummer 015123456789 nach 1 Sekunden ab. 109 | [2019-08-02 17:03:20.433] [LOG] Keine AML-Daten zur Nummer 015123456789 verfügbar. 110 | [2019-08-02 17:03:24.895] [LOG] Frage AML-Daten für Rufnummer 015123456789 nach 6 Sekunden ab. 111 | [2019-08-02 17:03:25.303] [LOG] AML-Daten zur Nummer 015123456789 vorhanden, übermittle Daten an das Einsatzleitsystem. 112 | [2019-08-02 17:03:25.304] [LOG] Position: 51.733152, 14.337873 (wifi) 113 | [2019-08-02 17:03:25.304] [LOG] Genauigkeit: 17.489 114 | [2019-08-02 17:03:25.304] [LOG] Geschwindigkeit: 5 m/s - Richtung: 192 Grad 115 | [2019-08-02 17:03:25.304] [LOG] ISSI: 1234567 116 | ``` 117 | 118 | # Lizenz 119 | #### [\[Creative Commons Attribution Share Alike 4.0 International\]](https://github.com/Robert-112/Wachalarm-IP-Web/blob/master/LICENSE.md) -------------------------------------------------------------------------------- /public/aml.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Fehler: ".$error_msg."

"; 56 | }; 57 | // Wenn nicht 'ok', dann Fehler ausgeben 58 | if ($response == '[{"status":"no aml data"}]') { 59 | $text .= "Keine Ortungsdaten für Telefon ".$telefon." vorhanden.

"; 60 | }; 61 | // JSON-Ergebnis docodieren 62 | $obj = json_decode($response); 63 | $text .= "Abfrage für Telefonnummer: ".$obj[0]->{'number'}." (Enr ".$enr_str.")
"; 64 | $text .= "Zeitpunkt der Ortung: ".$obj[0]->{'location_time'}."
"; 65 | $text .= "GPS Koordinate (WGS84DEZ): ".$obj[0]->{'location_longitude'}."/".$obj[0]->{'location_latitude'}."
"; 66 | $text .= "Genauigkeit in Meter: ".round($obj[0]->{'location_accuracy'},0)."
"; 67 | $text .= "Geschwindigkeit: ".round($obj[0]->{'location_speed'}*3.6,0)." km/h - Richtung ".round($obj[0]->{'location_bearing'},0)." Grad
"; 68 | $text .= "Quelle der Ortungsdaten am Endgerät: ".$obj[0]->{'location_source'}.""; 69 | if ($obj[0]->{'location_source'}=='cell') { 70 | $text .= ' Achtung - Es konnte nur der Standort der Funkzelle ermittelt werden.'; 71 | }; 72 | $text .= "
"; 73 | // Ergebnis auf der Webseite ausgeben 74 | echo $text; 75 | // Protokoll-Dateien erstellen im Ordner ../log 76 | file_put_contents('../log/'.date("Y.n.j").'.log', (date("d.m.Y H:i:s")." UTC ".$text."\n".$response."\n"), FILE_APPEND); 77 | ?> 78 | 79 |
80 | 137 |

Allgemeine Hinweise:
138 | Zur Zeit können nur neuere Android Smartphones geortet werden. iPhones sollen bis Ende 2019 folgen. Das Smartphone benötigt eine Datenverbindung um die Daten zu übermitteln. GPS wird automatisch beim Notruf aktiviert. Die Ortungsdaten werden automatisch bei der Anwahl des Notrufs 112 übertragen und sind für eine Stunde abrufbar. Wenn das Smartphone keinen Notruf gewählt hat, ist keine Ortung möglich. Man muss keine App installieren.

139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | // Module laden 2 | const dgram = require('dgram'); 3 | const udp_server = dgram.createSocket({ 4 | type: "udp4", 5 | reuseAddr: true 6 | }); 7 | const hex2ascii = require('hex2ascii'); 8 | const request = require('request'); 9 | const fs = require('fs'); 10 | require('console-stamp')(console, { 11 | pattern: 'yyyy-mm-dd HH:MM:ss.l' 12 | }) 13 | 14 | // Config-Datei laden 15 | var app_cfg = require('./config/app_cfg.js'); 16 | 17 | // UDP-Einstellungen 18 | const UDP_PORT = app_cfg.udp_port; 19 | const MULTICAST_ADDR = app_cfg.multicast_addr; 20 | 21 | // zu verwendende ISSIs definieren 22 | var usable_issi = app_cfg.issi; 23 | 24 | // Aufbau phone_data: Zeitstempel, Rufnummer, AML_JSON, ISSI 25 | var phone_data = {}; 26 | 27 | // TODO: beim Script-Strat alles zurücksetzen 28 | 29 | // Warten auf UDP-Daten 30 | udp_server.on('message', function (message, remote) { 31 | // empfangene Daten in hex umwandeln 32 | var data_hex = Buffer.from(message).toString('hex'); 33 | console.log('DEBUG (UDP-Daten): ' + data_hex); 34 | // wenn x30 und x05 im Paket vorhanden, dann ist es eine Anruf-Signalisierung direkt per Multicast 35 | if (data_hex.substr(16, 2) == '30' && data_hex.substr(18, 2) == '05') { 36 | // variablen Teil des Paketes auswerten 37 | var var_hex = data_hex.substr(144, data_hex.length); 38 | // Kanalnummer ermitteln 39 | var kanal_laenge = parseInt('0x' + var_hex.substr(0, 2)); 40 | var kanal_nr = hex2ascii(var_hex.substr(2, kanal_laenge * 2)); 41 | // Kanal-werte entfernen 42 | var_hex = var_hex.substr(2 + (kanal_laenge * 2), var_hex.length) 43 | // Telefonnummer ermitteln 44 | var telefon_laenge = parseInt('0x' + var_hex.substr(0, 2)); 45 | var telefon_nr = hex2ascii(var_hex.substr(2, telefon_laenge * 2)); 46 | // erste 0 von Telefonnummer entfernen 47 | telefon_nr = telefon_nr.toString().substr(1); 48 | // Daten nur Speichern wenn eine Kanalnummer im Bereich des Notrufes liegt, und es keine Festnetznummer mit 03 am Anfang ist 49 | if (app_cfg.kanalnummer_min < kanal_nr && kanal_nr < app_cfg.kanalnummer_max && telefon_nr.substr(0, 2) !== app_cfg.vorwahlfilter) { 50 | // falls die Telefonnummer schon vorhanden ist (erneuerter Anruf), Zeit dort neu setzen 51 | if (telefon_nr in phone_data) { 52 | phone_data[telefon_nr].zeitstempel = Date.now(); 53 | } else { 54 | // Telefondaten in phone_data mit Zeitstempel schreiben 55 | var tmp_obj = {}; 56 | tmp_obj.zeitstempel = Date.now(); 57 | phone_data[telefon_nr] = tmp_obj; 58 | console.log('Notruf-Anwahl auf Kanal ' + kanal_nr + ' erkannt. Rufnummer: ' + telefon_nr); 59 | }; 60 | }; 61 | } else { 62 | // pruefen ob es eine Signalisierung per RAU-Signal ist, sonst verwerfen 63 | if (data_hex.substr(16, 2) == '10' && data_hex.substr(18, 2) == '05') { 64 | console.log('DEBUG (Anrufsignal): ' + data_hex); 65 | // variablen Teil des Paketes auswerten 66 | var var_hex = data_hex.substr(134, data_hex.length); 67 | // Kanalnummer ermitteln 68 | var kanal_nr = hex2ascii(var_hex.substr(0, var_hex.indexOf('0d'))); 69 | console.log('DEBUG (Kanal_Nr): ' + kanal_nr); 70 | // Telefonnummer ermitteln 71 | var telefon_nr = var_hex.substr(var_hex.indexOf('0d') + 2, var_hex.length); 72 | telefon_nr = telefon_nr.substr(0, telefon_nr.indexOf('0a')); 73 | telefon_nr = hex2ascii(telefon_nr); 74 | console.log('DEBUG (Telefonnummer): ' + telefon_nr); 75 | // erste 0 von Telefonnummer entfernen 76 | telefon_nr = telefon_nr.toString().substr(1); 77 | // Daten nur Speichern wenn eine Kanalnummer im Bereich des Notrufes liegt, und es keine Festnetznummer mit 03 am Anfang ist 78 | if (app_cfg.kanalnummer_min < kanal_nr && kanal_nr < app_cfg.kanalnummer_max && telefon_nr.substr(0, 2) !== app_cfg.vorwahlfilter) { 79 | // falls die Telefonnummer schon vorhanden ist (erneuerter Anruf), Zeit dort neu setzen 80 | if (telefon_nr in phone_data) { 81 | phone_data[telefon_nr].zeitstempel = Date.now(); 82 | } else { 83 | // Telefondaten in phone_data mit Zeitstempel schreiben 84 | var tmp_obj = {}; 85 | tmp_obj.zeitstempel = Date.now(); 86 | phone_data[telefon_nr] = tmp_obj; 87 | console.log('Notruf-Annahme auf Kanal ' + kanal_nr + ' erkannt. Rufnummer: ' + telefon_nr); 88 | }; 89 | }; 90 | }; 91 | }; 92 | }); 93 | 94 | // jede Sekunde neue/alte Daten auswerten 95 | setInterval(function () { 96 | // phone_data jede Sekunde durchgehen 97 | const phones = Object.keys(phone_data) 98 | for (const phone of phones) { 99 | if (typeof phone_data[phone] !== 'undefined') { 100 | var time_passed = Math.round(Math.floor((new Date() - phone_data[phone].zeitstempel) / 1000)) 101 | // AML-Daten nach 1, 6, 11, 21 und 45 Sekunden abrufen 102 | if ( 103 | time_passed == 1 || 104 | time_passed == 6 || 105 | time_passed == 11 || 106 | time_passed == 21 || 107 | time_passed == 45 108 | ) { 109 | console.log('Frage AML-Daten für Rufnummer ' + phone + ' nach ' + time_passed + ' Sekunden ab.'); 110 | // Datei zur Überwachung schreiben 111 | fs.writeFile("./aml_gesendet.txt", Date.now(), function (err) { 112 | if (err) { 113 | return console.error(err); 114 | }; 115 | }); 116 | // AML-Anfrage mit Telefonnummer 117 | var req_options = { 118 | url: app_cfg.aml_url + phone, 119 | port: app_cfg.aml_port, 120 | auth: { 121 | user: app_cfg.aml_auth_user, 122 | pass: app_cfg.aml_auth_pass 123 | }, 124 | proxy: app_cfg.proxy, 125 | cert: fs.readFileSync(app_cfg.aml_cert, 'utf8'), 126 | key: fs.readFileSync(app_cfg.aml_key, 'utf8'), 127 | passphrase: app_cfg.aml_passphrase, 128 | ca: fs.readFileSync(app_cfg.aml_ca, 'utf8'), 129 | agentOptions: { 130 | secureProtocol: 'TLSv1_2_method' 131 | } 132 | }; 133 | // AML-Antwort auswerten 134 | request.get(req_options, function (error, response, body) { 135 | if (!error && response.statusCode == 200) { 136 | // Fehler-Datei löschen, falls vorhanden 137 | fs.stat("./aml_fehler.txt", function (err, stats) { 138 | if (!err) { 139 | fs.unlink('./aml_fehler.txt', function (err) { 140 | if (err) { 141 | return console.log(err); 142 | }; 143 | }); 144 | }; 145 | }); 146 | // request in JSON umwandeln und in phone_data speichern 147 | phone_data[phone].aml = JSON.parse(body); 148 | // wenn AML-Status (erste Zeile) OK und Koordinate genauer als 50 Meter, dann weiter 149 | if (phone_data[phone].aml[0].status == 'ok' && parseInt(phone_data[phone].aml[0].location_accuracy) < app_cfg.location_accuracy_max) { 150 | // Datei zur Überwachung schreiben 151 | fs.writeFile("./aml_erhalten.txt", Date.now(), function (err) { 152 | if (err) { 153 | return console.log(err); 154 | }; 155 | }); 156 | // erste verfügbare ISSI wählen und setzen, sofern noch keine ISSI vorhanden 157 | if (!("issi" in phone_data[phone])) { 158 | var issi_to_use = usable_issi[0].issi; 159 | // falls diese ISSI bereits einer Telefonnumer zugeordnet ist, dann bei dieser Nummer die ISSI löschen 160 | if (("phone" in usable_issi[0])) { 161 | delete phone_data[usable_issi[0].phone].issi; 162 | }; 163 | // Telefonnummer zur ISSI dazu schreiben, um später zu erkennen ob ISSI schon verwendet wird 164 | usable_issi[0].phone = phone; 165 | // ISSI in phone_data setzen 166 | phone_data[phone].issi = issi_to_use; 167 | // ISSI nach hinten schieben damit beim nächsten Durchlauf die nächste ISSI genutzt wird 168 | usable_issi.push(usable_issi.shift()); 169 | }; 170 | // AML-Daten erhalten 171 | console.log('AML-Daten zur Nummer ' + phone + ' vorhanden, übermittle Daten an das Einsatzleitsystem.'); 172 | console.log('Position: ' + phone_data[phone].aml[0].location_latitude + ', ' + phone_data[phone].aml[0].location_longitude + ' (' + phone_data[phone].aml[0].location_source + ')'); 173 | console.log('Genauigkeit: ' + phone_data[phone].aml[0].location_accuracy); 174 | console.log('Geschwindigkeit: ' + phone_data[phone].aml[0].location_speed + ' m/s - Richtung: ' + phone_data[phone].aml[0].location_bearing +' Grad'); 175 | console.log('ISSI: ' + phone_data[phone].issi); 176 | var xml_fms_status = app_cfg.status_fms_1[0] + phone_data[phone].issi + app_cfg.status_fms_1[1]; 177 | var xml_geo_position = app_cfg.status_position[0] + phone_data[phone].issi + app_cfg.status_position[1] + phone_data[phone].aml[0].location_longitude + app_cfg.status_position[2] + phone_data[phone].aml[0].location_latitude + app_cfg.status_position[3]; 178 | // Status 1 für ISSI senden 179 | request.post({ 180 | url: app_cfg.status_url, 181 | port: app_cfg.status_port, 182 | method: "POST", 183 | headers: { 184 | 'Content-Type': 'application/xml', 185 | }, 186 | body: xml_fms_status 187 | }, function (error, response, body) { 188 | if (error || response.statusCode !== 200) { 189 | console.error('XML für Status konnte nicht gesendet werden: ' + error + ' ' + response.statusCode); 190 | }; 191 | }); 192 | // Position senden 193 | request.post({ 194 | url: app_cfg.status_url, 195 | port: app_cfg.status_port, 196 | method: "POST", 197 | headers: { 198 | 'Content-Type': 'application/xml', 199 | }, 200 | body: xml_geo_position 201 | }, function (error, response, body) { 202 | if (error || response.statusCode !== 200) { 203 | console.error('XML für Position konnte nicht gesendet werden: ' + error + ' ' + response.statusCode); 204 | }; 205 | }); 206 | } else { 207 | if (phone_data[phone].aml[0].status !== 'ok') { 208 | console.log('Keine AML-Daten zur Nummer ' + phone + ' verfügbar.'); 209 | } else { 210 | console.info('AML-Daten zur Nummer ' + phone + ' zu ungenau. location_accuracy: ' + phone_data[phone].aml[0].location_accuracy); 211 | }; 212 | }; 213 | } else { 214 | console.error('error:', error); 215 | console.error('statusCode:', response && response.statusCode); 216 | // falls ein HTML-Fehler bei der Anfrage auftritt, in phone_data dennoch einen aml.status setzen 217 | phone_data[phone].aml = [{ 218 | "status": "error" 219 | }]; 220 | // Datei zur Überwachung schreiben, falls die AML-Anfrage scheitert 221 | fs.writeFile("./aml_fehler.txt", response.statusCode, function (err) { 222 | if (err) { 223 | return console.log(err); 224 | }; 225 | }); 226 | }; 227 | }); 228 | }; 229 | // nach 50 Sekunden ohne Daten, oder nach 300 Sekunden, alles löschen und Status 2 für ISSI 230 | if ( 231 | (time_passed > 50 && phone_data[phone].aml[0].status !== 'ok') || 232 | time_passed > 300 233 | ) { 234 | console.log('Lösche Daten für Telefonnummer ' + phone + ' nach ' + time_passed + ' Sekunden!'); 235 | // temporäre Kopie von phone_data anlegen 236 | var tmp_obj = phone_data[phone]; 237 | // Daten aus Objekt phone_data löschen 238 | delete phone_data[phone]; 239 | // Sende Status 2 für ISSI, sofern vorhanden 240 | if (("issi" in tmp_obj)) { 241 | tmp_issi = {}; 242 | tmp_issi.issi = tmp_obj.issi; 243 | //ISSI in Liste wieder nach oben geben 244 | usable_issi = usable_issi.filter(item => item.issi !== tmp_obj.issi); 245 | usable_issi.unshift(tmp_issi); 246 | if (("phone" in usable_issi[0])) { 247 | delete usable_issi[0].phone; 248 | }; 249 | // Status senden 250 | console.log('Sende Satus 2 für ISSI ' + tmp_obj.issi); 251 | var xml_fms_status = app_cfg.status_fms_2[0] + tmp_obj.issi + app_cfg.status_fms_2[1]; 252 | request.post({ 253 | url: app_cfg.status_url, 254 | port: app_cfg.status_port, 255 | method: "POST", 256 | headers: { 257 | 'Content-Type': 'application/xml', 258 | }, 259 | body: xml_fms_status 260 | }, function (error, response, body) { 261 | if (error || response.statusCode !== 200) { 262 | console.error('XML für Status konnte nicht gesendet werden: ' + error + ' ' + response.statusCode); 263 | }; 264 | }); 265 | }; 266 | }; 267 | }; 268 | }; 269 | }, 1000); 270 | 271 | // UDP-Server für Schnittstelle starten 272 | udp_server.bind(UDP_PORT); 273 | udp_server.on('listening', function () { 274 | udp_server.addMembership(MULTICAST_ADDR); 275 | var address = udp_server.address(); 276 | console.info('UDP Server auf ' + address.address + ':' + address.port + ' gestartet. PID: ' + process.pid); 277 | }); 278 | -------------------------------------------------------------------------------- /public/resources/leaflet.css: -------------------------------------------------------------------------------- 1 | /* required styles */ 2 | 3 | .leaflet-pane, 4 | .leaflet-tile, 5 | .leaflet-marker-icon, 6 | .leaflet-marker-shadow, 7 | .leaflet-tile-container, 8 | .leaflet-pane > svg, 9 | .leaflet-pane > canvas, 10 | .leaflet-zoom-box, 11 | .leaflet-image-layer, 12 | .leaflet-layer { 13 | position: absolute; 14 | left: 0; 15 | top: 0; 16 | } 17 | .leaflet-container { 18 | overflow: hidden; 19 | } 20 | .leaflet-tile, 21 | .leaflet-marker-icon, 22 | .leaflet-marker-shadow { 23 | -webkit-user-select: none; 24 | -moz-user-select: none; 25 | user-select: none; 26 | -webkit-user-drag: none; 27 | } 28 | /* Prevents IE11 from highlighting tiles in blue */ 29 | .leaflet-tile::selection { 30 | background: transparent; 31 | } 32 | /* Safari renders non-retina tile on retina better with this, but Chrome is worse */ 33 | .leaflet-safari .leaflet-tile { 34 | image-rendering: -webkit-optimize-contrast; 35 | } 36 | /* hack that prevents hw layers "stretching" when loading new tiles */ 37 | .leaflet-safari .leaflet-tile-container { 38 | width: 1600px; 39 | height: 1600px; 40 | -webkit-transform-origin: 0 0; 41 | } 42 | .leaflet-marker-icon, 43 | .leaflet-marker-shadow { 44 | display: block; 45 | } 46 | /* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */ 47 | /* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */ 48 | .leaflet-container .leaflet-overlay-pane svg, 49 | .leaflet-container .leaflet-marker-pane img, 50 | .leaflet-container .leaflet-shadow-pane img, 51 | .leaflet-container .leaflet-tile-pane img, 52 | .leaflet-container img.leaflet-image-layer, 53 | .leaflet-container .leaflet-tile { 54 | max-width: none !important; 55 | max-height: none !important; 56 | } 57 | 58 | .leaflet-container.leaflet-touch-zoom { 59 | -ms-touch-action: pan-x pan-y; 60 | touch-action: pan-x pan-y; 61 | } 62 | .leaflet-container.leaflet-touch-drag { 63 | -ms-touch-action: pinch-zoom; 64 | /* Fallback for FF which doesn't support pinch-zoom */ 65 | touch-action: none; 66 | touch-action: pinch-zoom; 67 | } 68 | .leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { 69 | -ms-touch-action: none; 70 | touch-action: none; 71 | } 72 | .leaflet-container { 73 | -webkit-tap-highlight-color: transparent; 74 | } 75 | .leaflet-container a { 76 | -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4); 77 | } 78 | .leaflet-tile { 79 | filter: inherit; 80 | visibility: hidden; 81 | } 82 | .leaflet-tile-loaded { 83 | visibility: inherit; 84 | } 85 | .leaflet-zoom-box { 86 | width: 0; 87 | height: 0; 88 | -moz-box-sizing: border-box; 89 | box-sizing: border-box; 90 | z-index: 800; 91 | } 92 | /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ 93 | .leaflet-overlay-pane svg { 94 | -moz-user-select: none; 95 | } 96 | 97 | .leaflet-pane { z-index: 400; } 98 | 99 | .leaflet-tile-pane { z-index: 200; } 100 | .leaflet-overlay-pane { z-index: 400; } 101 | .leaflet-shadow-pane { z-index: 500; } 102 | .leaflet-marker-pane { z-index: 600; } 103 | .leaflet-tooltip-pane { z-index: 650; } 104 | .leaflet-popup-pane { z-index: 700; } 105 | 106 | .leaflet-map-pane canvas { z-index: 100; } 107 | .leaflet-map-pane svg { z-index: 200; } 108 | 109 | .leaflet-vml-shape { 110 | width: 1px; 111 | height: 1px; 112 | } 113 | .lvml { 114 | behavior: url(#default#VML); 115 | display: inline-block; 116 | position: absolute; 117 | } 118 | 119 | 120 | /* control positioning */ 121 | 122 | .leaflet-control { 123 | position: relative; 124 | z-index: 800; 125 | pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ 126 | pointer-events: auto; 127 | } 128 | .leaflet-top, 129 | .leaflet-bottom { 130 | position: absolute; 131 | z-index: 1000; 132 | pointer-events: none; 133 | } 134 | .leaflet-top { 135 | top: 0; 136 | } 137 | .leaflet-right { 138 | right: 0; 139 | } 140 | .leaflet-bottom { 141 | bottom: 0; 142 | } 143 | .leaflet-left { 144 | left: 0; 145 | } 146 | .leaflet-control { 147 | float: left; 148 | clear: both; 149 | } 150 | .leaflet-right .leaflet-control { 151 | float: right; 152 | } 153 | .leaflet-top .leaflet-control { 154 | margin-top: 10px; 155 | } 156 | .leaflet-bottom .leaflet-control { 157 | margin-bottom: 10px; 158 | } 159 | .leaflet-left .leaflet-control { 160 | margin-left: 10px; 161 | } 162 | .leaflet-right .leaflet-control { 163 | margin-right: 10px; 164 | } 165 | 166 | 167 | /* zoom and fade animations */ 168 | 169 | .leaflet-fade-anim .leaflet-tile { 170 | will-change: opacity; 171 | } 172 | .leaflet-fade-anim .leaflet-popup { 173 | opacity: 0; 174 | -webkit-transition: opacity 0.2s linear; 175 | -moz-transition: opacity 0.2s linear; 176 | transition: opacity 0.2s linear; 177 | } 178 | .leaflet-fade-anim .leaflet-map-pane .leaflet-popup { 179 | opacity: 1; 180 | } 181 | .leaflet-zoom-animated { 182 | -webkit-transform-origin: 0 0; 183 | -ms-transform-origin: 0 0; 184 | transform-origin: 0 0; 185 | } 186 | .leaflet-zoom-anim .leaflet-zoom-animated { 187 | will-change: transform; 188 | } 189 | .leaflet-zoom-anim .leaflet-zoom-animated { 190 | -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); 191 | -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); 192 | transition: transform 0.25s cubic-bezier(0,0,0.25,1); 193 | } 194 | .leaflet-zoom-anim .leaflet-tile, 195 | .leaflet-pan-anim .leaflet-tile { 196 | -webkit-transition: none; 197 | -moz-transition: none; 198 | transition: none; 199 | } 200 | 201 | .leaflet-zoom-anim .leaflet-zoom-hide { 202 | visibility: hidden; 203 | } 204 | 205 | 206 | /* cursors */ 207 | 208 | .leaflet-interactive { 209 | cursor: pointer; 210 | } 211 | .leaflet-grab { 212 | cursor: -webkit-grab; 213 | cursor: -moz-grab; 214 | cursor: grab; 215 | } 216 | .leaflet-crosshair, 217 | .leaflet-crosshair .leaflet-interactive { 218 | cursor: crosshair; 219 | } 220 | .leaflet-popup-pane, 221 | .leaflet-control { 222 | cursor: auto; 223 | } 224 | .leaflet-dragging .leaflet-grab, 225 | .leaflet-dragging .leaflet-grab .leaflet-interactive, 226 | .leaflet-dragging .leaflet-marker-draggable { 227 | cursor: move; 228 | cursor: -webkit-grabbing; 229 | cursor: -moz-grabbing; 230 | cursor: grabbing; 231 | } 232 | 233 | /* marker & overlays interactivity */ 234 | .leaflet-marker-icon, 235 | .leaflet-marker-shadow, 236 | .leaflet-image-layer, 237 | .leaflet-pane > svg path, 238 | .leaflet-tile-container { 239 | pointer-events: none; 240 | } 241 | 242 | .leaflet-marker-icon.leaflet-interactive, 243 | .leaflet-image-layer.leaflet-interactive, 244 | .leaflet-pane > svg path.leaflet-interactive, 245 | svg.leaflet-image-layer.leaflet-interactive path { 246 | pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ 247 | pointer-events: auto; 248 | } 249 | 250 | /* visual tweaks */ 251 | 252 | .leaflet-container { 253 | background: #ddd; 254 | outline: 0; 255 | } 256 | .leaflet-container a { 257 | color: #0078A8; 258 | } 259 | .leaflet-container a.leaflet-active { 260 | outline: 2px solid orange; 261 | } 262 | .leaflet-zoom-box { 263 | border: 2px dotted #38f; 264 | background: rgba(255,255,255,0.5); 265 | } 266 | 267 | 268 | /* general typography */ 269 | .leaflet-container { 270 | font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; 271 | } 272 | 273 | 274 | /* general toolbar styles */ 275 | 276 | .leaflet-bar { 277 | box-shadow: 0 1px 5px rgba(0,0,0,0.65); 278 | border-radius: 4px; 279 | } 280 | .leaflet-bar a, 281 | .leaflet-bar a:hover { 282 | background-color: #fff; 283 | border-bottom: 1px solid #ccc; 284 | width: 26px; 285 | height: 26px; 286 | line-height: 26px; 287 | display: block; 288 | text-align: center; 289 | text-decoration: none; 290 | color: black; 291 | } 292 | .leaflet-bar a, 293 | .leaflet-control-layers-toggle { 294 | background-position: 50% 50%; 295 | background-repeat: no-repeat; 296 | display: block; 297 | } 298 | .leaflet-bar a:hover { 299 | background-color: #f4f4f4; 300 | } 301 | .leaflet-bar a:first-child { 302 | border-top-left-radius: 4px; 303 | border-top-right-radius: 4px; 304 | } 305 | .leaflet-bar a:last-child { 306 | border-bottom-left-radius: 4px; 307 | border-bottom-right-radius: 4px; 308 | border-bottom: none; 309 | } 310 | .leaflet-bar a.leaflet-disabled { 311 | cursor: default; 312 | background-color: #f4f4f4; 313 | color: #bbb; 314 | } 315 | 316 | .leaflet-touch .leaflet-bar a { 317 | width: 30px; 318 | height: 30px; 319 | line-height: 30px; 320 | } 321 | .leaflet-touch .leaflet-bar a:first-child { 322 | border-top-left-radius: 2px; 323 | border-top-right-radius: 2px; 324 | } 325 | .leaflet-touch .leaflet-bar a:last-child { 326 | border-bottom-left-radius: 2px; 327 | border-bottom-right-radius: 2px; 328 | } 329 | 330 | /* zoom control */ 331 | 332 | .leaflet-control-zoom-in, 333 | .leaflet-control-zoom-out { 334 | font: bold 18px 'Lucida Console', Monaco, monospace; 335 | text-indent: 1px; 336 | } 337 | 338 | .leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out { 339 | font-size: 22px; 340 | } 341 | 342 | 343 | /* layers control */ 344 | 345 | .leaflet-control-layers { 346 | box-shadow: 0 1px 5px rgba(0,0,0,0.4); 347 | background: #fff; 348 | border-radius: 5px; 349 | } 350 | .leaflet-control-layers-toggle { 351 | background-image: url(images/layers.png); 352 | width: 36px; 353 | height: 36px; 354 | } 355 | .leaflet-retina .leaflet-control-layers-toggle { 356 | background-image: url(images/layers-2x.png); 357 | background-size: 26px 26px; 358 | } 359 | .leaflet-touch .leaflet-control-layers-toggle { 360 | width: 44px; 361 | height: 44px; 362 | } 363 | .leaflet-control-layers .leaflet-control-layers-list, 364 | .leaflet-control-layers-expanded .leaflet-control-layers-toggle { 365 | display: none; 366 | } 367 | .leaflet-control-layers-expanded .leaflet-control-layers-list { 368 | display: block; 369 | position: relative; 370 | } 371 | .leaflet-control-layers-expanded { 372 | padding: 6px 10px 6px 6px; 373 | color: #333; 374 | background: #fff; 375 | } 376 | .leaflet-control-layers-scrollbar { 377 | overflow-y: scroll; 378 | overflow-x: hidden; 379 | padding-right: 5px; 380 | } 381 | .leaflet-control-layers-selector { 382 | margin-top: 2px; 383 | position: relative; 384 | top: 1px; 385 | } 386 | .leaflet-control-layers label { 387 | display: block; 388 | } 389 | .leaflet-control-layers-separator { 390 | height: 0; 391 | border-top: 1px solid #ddd; 392 | margin: 5px -10px 5px -6px; 393 | } 394 | 395 | /* Default icon URLs */ 396 | .leaflet-default-icon-path { 397 | background-image: url(images/marker-icon.png); 398 | } 399 | 400 | 401 | /* attribution and scale controls */ 402 | 403 | .leaflet-container .leaflet-control-attribution { 404 | background: #fff; 405 | background: rgba(255, 255, 255, 0.7); 406 | margin: 0; 407 | } 408 | .leaflet-control-attribution, 409 | .leaflet-control-scale-line { 410 | padding: 0 5px; 411 | color: #333; 412 | } 413 | .leaflet-control-attribution a { 414 | text-decoration: none; 415 | } 416 | .leaflet-control-attribution a:hover { 417 | text-decoration: underline; 418 | } 419 | .leaflet-container .leaflet-control-attribution, 420 | .leaflet-container .leaflet-control-scale { 421 | font-size: 11px; 422 | } 423 | .leaflet-left .leaflet-control-scale { 424 | margin-left: 5px; 425 | } 426 | .leaflet-bottom .leaflet-control-scale { 427 | margin-bottom: 5px; 428 | } 429 | .leaflet-control-scale-line { 430 | border: 2px solid #777; 431 | border-top: none; 432 | line-height: 1.1; 433 | padding: 2px 5px 1px; 434 | font-size: 11px; 435 | white-space: nowrap; 436 | overflow: hidden; 437 | -moz-box-sizing: border-box; 438 | box-sizing: border-box; 439 | 440 | background: #fff; 441 | background: rgba(255, 255, 255, 0.5); 442 | } 443 | .leaflet-control-scale-line:not(:first-child) { 444 | border-top: 2px solid #777; 445 | border-bottom: none; 446 | margin-top: -2px; 447 | } 448 | .leaflet-control-scale-line:not(:first-child):not(:last-child) { 449 | border-bottom: 2px solid #777; 450 | } 451 | 452 | .leaflet-touch .leaflet-control-attribution, 453 | .leaflet-touch .leaflet-control-layers, 454 | .leaflet-touch .leaflet-bar { 455 | box-shadow: none; 456 | } 457 | .leaflet-touch .leaflet-control-layers, 458 | .leaflet-touch .leaflet-bar { 459 | border: 2px solid rgba(0,0,0,0.2); 460 | background-clip: padding-box; 461 | } 462 | 463 | 464 | /* popup */ 465 | 466 | .leaflet-popup { 467 | position: absolute; 468 | text-align: center; 469 | margin-bottom: 20px; 470 | } 471 | .leaflet-popup-content-wrapper { 472 | padding: 1px; 473 | text-align: left; 474 | border-radius: 12px; 475 | } 476 | .leaflet-popup-content { 477 | margin: 13px 19px; 478 | line-height: 1.4; 479 | } 480 | .leaflet-popup-content p { 481 | margin: 18px 0; 482 | } 483 | .leaflet-popup-tip-container { 484 | width: 40px; 485 | height: 20px; 486 | position: absolute; 487 | left: 50%; 488 | margin-left: -20px; 489 | overflow: hidden; 490 | pointer-events: none; 491 | } 492 | .leaflet-popup-tip { 493 | width: 17px; 494 | height: 17px; 495 | padding: 1px; 496 | 497 | margin: -10px auto 0; 498 | 499 | -webkit-transform: rotate(45deg); 500 | -moz-transform: rotate(45deg); 501 | -ms-transform: rotate(45deg); 502 | transform: rotate(45deg); 503 | } 504 | .leaflet-popup-content-wrapper, 505 | .leaflet-popup-tip { 506 | background: white; 507 | color: #333; 508 | box-shadow: 0 3px 14px rgba(0,0,0,0.4); 509 | } 510 | .leaflet-container a.leaflet-popup-close-button { 511 | position: absolute; 512 | top: 0; 513 | right: 0; 514 | padding: 4px 4px 0 0; 515 | border: none; 516 | text-align: center; 517 | width: 18px; 518 | height: 14px; 519 | font: 16px/14px Tahoma, Verdana, sans-serif; 520 | color: #c3c3c3; 521 | text-decoration: none; 522 | font-weight: bold; 523 | background: transparent; 524 | } 525 | .leaflet-container a.leaflet-popup-close-button:hover { 526 | color: #999; 527 | } 528 | .leaflet-popup-scrolled { 529 | overflow: auto; 530 | border-bottom: 1px solid #ddd; 531 | border-top: 1px solid #ddd; 532 | } 533 | 534 | .leaflet-oldie .leaflet-popup-content-wrapper { 535 | zoom: 1; 536 | } 537 | .leaflet-oldie .leaflet-popup-tip { 538 | width: 24px; 539 | margin: 0 auto; 540 | 541 | -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; 542 | filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); 543 | } 544 | .leaflet-oldie .leaflet-popup-tip-container { 545 | margin-top: -1px; 546 | } 547 | 548 | .leaflet-oldie .leaflet-control-zoom, 549 | .leaflet-oldie .leaflet-control-layers, 550 | .leaflet-oldie .leaflet-popup-content-wrapper, 551 | .leaflet-oldie .leaflet-popup-tip { 552 | border: 1px solid #999; 553 | } 554 | 555 | 556 | /* div icon */ 557 | 558 | .leaflet-div-icon { 559 | background: #fff; 560 | border: 1px solid #666; 561 | } 562 | 563 | 564 | /* Tooltip */ 565 | /* Base styles for the element that has a tooltip */ 566 | .leaflet-tooltip { 567 | position: absolute; 568 | padding: 6px; 569 | background-color: #fff; 570 | border: 1px solid #fff; 571 | border-radius: 3px; 572 | color: #222; 573 | white-space: nowrap; 574 | -webkit-user-select: none; 575 | -moz-user-select: none; 576 | -ms-user-select: none; 577 | user-select: none; 578 | pointer-events: none; 579 | box-shadow: 0 1px 3px rgba(0,0,0,0.4); 580 | } 581 | .leaflet-tooltip.leaflet-clickable { 582 | cursor: pointer; 583 | pointer-events: auto; 584 | } 585 | .leaflet-tooltip-top:before, 586 | .leaflet-tooltip-bottom:before, 587 | .leaflet-tooltip-left:before, 588 | .leaflet-tooltip-right:before { 589 | position: absolute; 590 | pointer-events: none; 591 | border: 6px solid transparent; 592 | background: transparent; 593 | content: ""; 594 | } 595 | 596 | /* Directions */ 597 | 598 | .leaflet-tooltip-bottom { 599 | margin-top: 6px; 600 | } 601 | .leaflet-tooltip-top { 602 | margin-top: -6px; 603 | } 604 | .leaflet-tooltip-bottom:before, 605 | .leaflet-tooltip-top:before { 606 | left: 50%; 607 | margin-left: -6px; 608 | } 609 | .leaflet-tooltip-top:before { 610 | bottom: 0; 611 | margin-bottom: -12px; 612 | border-top-color: #fff; 613 | } 614 | .leaflet-tooltip-bottom:before { 615 | top: 0; 616 | margin-top: -12px; 617 | margin-left: -6px; 618 | border-bottom-color: #fff; 619 | } 620 | .leaflet-tooltip-left { 621 | margin-left: -6px; 622 | } 623 | .leaflet-tooltip-right { 624 | margin-left: 6px; 625 | } 626 | .leaflet-tooltip-left:before, 627 | .leaflet-tooltip-right:before { 628 | top: 50%; 629 | margin-top: -6px; 630 | } 631 | .leaflet-tooltip-left:before { 632 | right: 0; 633 | margin-right: -12px; 634 | border-left-color: #fff; 635 | } 636 | .leaflet-tooltip-right:before { 637 | left: 0; 638 | margin-left: -12px; 639 | border-right-color: #fff; 640 | } 641 | -------------------------------------------------------------------------------- /public/resources/arrow.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('leaflet')) : 3 | typeof define === 'function' && define.amd ? define(['leaflet'], factory) : 4 | (factory(global.L)); 5 | }(this, (function (L$1) { 'use strict'; 6 | 7 | L$1 = L$1 && L$1.hasOwnProperty('default') ? L$1['default'] : L$1; 8 | 9 | // functional re-impl of L.Point.distanceTo, 10 | // with no dependency on Leaflet for easier testing 11 | function pointDistance(ptA, ptB) { 12 | var x = ptB.x - ptA.x; 13 | var y = ptB.y - ptA.y; 14 | return Math.sqrt(x * x + y * y); 15 | } 16 | 17 | var computeSegmentHeading = function computeSegmentHeading(a, b) { 18 | return (Math.atan2(b.y - a.y, b.x - a.x) * 180 / Math.PI + 90 + 360) % 360; 19 | }; 20 | 21 | var asRatioToPathLength = function asRatioToPathLength(_ref, totalPathLength) { 22 | var value = _ref.value, 23 | isInPixels = _ref.isInPixels; 24 | return isInPixels ? value / totalPathLength : value; 25 | }; 26 | 27 | function parseRelativeOrAbsoluteValue(value) { 28 | if (typeof value === 'string' && value.indexOf('%') !== -1) { 29 | return { 30 | value: parseFloat(value) / 100, 31 | isInPixels: false 32 | }; 33 | } 34 | var parsedValue = value ? parseFloat(value) : 0; 35 | return { 36 | value: parsedValue, 37 | isInPixels: parsedValue > 0 38 | }; 39 | } 40 | 41 | var pointsEqual = function pointsEqual(a, b) { 42 | return a.x === b.x && a.y === b.y; 43 | }; 44 | 45 | function pointsToSegments(pts) { 46 | return pts.reduce(function (segments, b, idx, points) { 47 | // this test skips same adjacent points 48 | if (idx > 0 && !pointsEqual(b, points[idx - 1])) { 49 | var a = points[idx - 1]; 50 | var distA = segments.length > 0 ? segments[segments.length - 1].distB : 0; 51 | var distAB = pointDistance(a, b); 52 | segments.push({ 53 | a: a, 54 | b: b, 55 | distA: distA, 56 | distB: distA + distAB, 57 | heading: computeSegmentHeading(a, b) 58 | }); 59 | } 60 | return segments; 61 | }, []); 62 | } 63 | 64 | function projectPatternOnPointPath(pts, pattern) { 65 | // 1. split the path into segment infos 66 | var segments = pointsToSegments(pts); 67 | var nbSegments = segments.length; 68 | if (nbSegments === 0) { 69 | return []; 70 | } 71 | 72 | var totalPathLength = segments[nbSegments - 1].distB; 73 | 74 | var offset = asRatioToPathLength(pattern.offset, totalPathLength); 75 | var endOffset = asRatioToPathLength(pattern.endOffset, totalPathLength); 76 | var repeat = asRatioToPathLength(pattern.repeat, totalPathLength); 77 | 78 | var repeatIntervalPixels = totalPathLength * repeat; 79 | var startOffsetPixels = offset > 0 ? totalPathLength * offset : 0; 80 | var endOffsetPixels = endOffset > 0 ? totalPathLength * endOffset : 0; 81 | 82 | // 2. generate the positions of the pattern as offsets from the path start 83 | var positionOffsets = []; 84 | var positionOffset = startOffsetPixels; 85 | do { 86 | positionOffsets.push(positionOffset); 87 | positionOffset += repeatIntervalPixels; 88 | } while (repeatIntervalPixels > 0 && positionOffset < totalPathLength - endOffsetPixels); 89 | 90 | // 3. projects offsets to segments 91 | var segmentIndex = 0; 92 | var segment = segments[0]; 93 | return positionOffsets.map(function (positionOffset) { 94 | // find the segment matching the offset, 95 | // starting from the previous one as offsets are ordered 96 | while (positionOffset > segment.distB && segmentIndex < nbSegments - 1) { 97 | segmentIndex++; 98 | segment = segments[segmentIndex]; 99 | } 100 | 101 | var segmentRatio = (positionOffset - segment.distA) / (segment.distB - segment.distA); 102 | return { 103 | pt: interpolateBetweenPoints(segment.a, segment.b, segmentRatio), 104 | heading: segment.heading 105 | }; 106 | }); 107 | } 108 | 109 | /** 110 | * Finds the point which lies on the segment defined by points A and B, 111 | * at the given ratio of the distance from A to B, by linear interpolation. 112 | */ 113 | function interpolateBetweenPoints(ptA, ptB, ratio) { 114 | if (ptB.x !== ptA.x) { 115 | return { 116 | x: ptA.x + ratio * (ptB.x - ptA.x), 117 | y: ptA.y + ratio * (ptB.y - ptA.y) 118 | }; 119 | } 120 | // special case where points lie on the same vertical axis 121 | return { 122 | x: ptA.x, 123 | y: ptA.y + (ptB.y - ptA.y) * ratio 124 | }; 125 | } 126 | 127 | (function() { 128 | // save these original methods before they are overwritten 129 | var proto_initIcon = L.Marker.prototype._initIcon; 130 | var proto_setPos = L.Marker.prototype._setPos; 131 | 132 | var oldIE = (L.DomUtil.TRANSFORM === 'msTransform'); 133 | 134 | L.Marker.addInitHook(function () { 135 | var iconOptions = this.options.icon && this.options.icon.options; 136 | var iconAnchor = iconOptions && this.options.icon.options.iconAnchor; 137 | if (iconAnchor) { 138 | iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px'); 139 | } 140 | this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom' ; 141 | this.options.rotationAngle = this.options.rotationAngle || 0; 142 | 143 | // Ensure marker keeps rotated during dragging 144 | this.on('drag', function(e) { e.target._applyRotation(); }); 145 | }); 146 | 147 | L.Marker.include({ 148 | _initIcon: function() { 149 | proto_initIcon.call(this); 150 | }, 151 | 152 | _setPos: function (pos) { 153 | proto_setPos.call(this, pos); 154 | this._applyRotation(); 155 | }, 156 | 157 | _applyRotation: function () { 158 | if(this.options.rotationAngle) { 159 | this._icon.style[L.DomUtil.TRANSFORM+'Origin'] = this.options.rotationOrigin; 160 | 161 | if(oldIE) { 162 | // for IE 9, use the 2D rotation 163 | this._icon.style[L.DomUtil.TRANSFORM] = 'rotate(' + this.options.rotationAngle + 'deg)'; 164 | } else { 165 | // for modern browsers, prefer the 3D accelerated version 166 | this._icon.style[L.DomUtil.TRANSFORM] += ' rotateZ(' + this.options.rotationAngle + 'deg)'; 167 | } 168 | } 169 | }, 170 | 171 | setRotationAngle: function(angle) { 172 | this.options.rotationAngle = angle; 173 | this.update(); 174 | return this; 175 | }, 176 | 177 | setRotationOrigin: function(origin) { 178 | this.options.rotationOrigin = origin; 179 | this.update(); 180 | return this; 181 | } 182 | }); 183 | })(); 184 | 185 | L$1.Symbol = L$1.Symbol || {}; 186 | 187 | /** 188 | * A simple dash symbol, drawn as a Polyline. 189 | * Can also be used for dots, if 'pixelSize' option is given the 0 value. 190 | */ 191 | L$1.Symbol.Dash = L$1.Class.extend({ 192 | options: { 193 | pixelSize: 10, 194 | pathOptions: {} 195 | }, 196 | 197 | initialize: function initialize(options) { 198 | L$1.Util.setOptions(this, options); 199 | this.options.pathOptions.clickable = false; 200 | }, 201 | 202 | buildSymbol: function buildSymbol(dirPoint, latLngs, map, index, total) { 203 | var opts = this.options; 204 | var d2r = Math.PI / 180; 205 | 206 | // for a dot, nothing more to compute 207 | if (opts.pixelSize <= 1) { 208 | return L$1.polyline([dirPoint.latLng, dirPoint.latLng], opts.pathOptions); 209 | } 210 | 211 | var midPoint = map.project(dirPoint.latLng); 212 | var angle = -(dirPoint.heading - 90) * d2r; 213 | var a = L$1.point(midPoint.x + opts.pixelSize * Math.cos(angle + Math.PI) / 2, midPoint.y + opts.pixelSize * Math.sin(angle) / 2); 214 | // compute second point by central symmetry to avoid unecessary cos/sin 215 | var b = midPoint.add(midPoint.subtract(a)); 216 | return L$1.polyline([map.unproject(a), map.unproject(b)], opts.pathOptions); 217 | } 218 | }); 219 | 220 | L$1.Symbol.dash = function (options) { 221 | return new L$1.Symbol.Dash(options); 222 | }; 223 | 224 | L$1.Symbol.ArrowHead = L$1.Class.extend({ 225 | options: { 226 | polygon: true, 227 | pixelSize: 10, 228 | headAngle: 60, 229 | pathOptions: { 230 | stroke: false, 231 | weight: 2 232 | } 233 | }, 234 | 235 | initialize: function initialize(options) { 236 | L$1.Util.setOptions(this, options); 237 | this.options.pathOptions.clickable = false; 238 | }, 239 | 240 | buildSymbol: function buildSymbol(dirPoint, latLngs, map, index, total) { 241 | return this.options.polygon ? L$1.polygon(this._buildArrowPath(dirPoint, map), this.options.pathOptions) : L$1.polyline(this._buildArrowPath(dirPoint, map), this.options.pathOptions); 242 | }, 243 | 244 | _buildArrowPath: function _buildArrowPath(dirPoint, map) { 245 | var d2r = Math.PI / 180; 246 | var tipPoint = map.project(dirPoint.latLng); 247 | var direction = -(dirPoint.heading - 90) * d2r; 248 | var radianArrowAngle = this.options.headAngle / 2 * d2r; 249 | 250 | var headAngle1 = direction + radianArrowAngle; 251 | var headAngle2 = direction - radianArrowAngle; 252 | var arrowHead1 = L$1.point(tipPoint.x - this.options.pixelSize * Math.cos(headAngle1), tipPoint.y + this.options.pixelSize * Math.sin(headAngle1)); 253 | var arrowHead2 = L$1.point(tipPoint.x - this.options.pixelSize * Math.cos(headAngle2), tipPoint.y + this.options.pixelSize * Math.sin(headAngle2)); 254 | 255 | return [map.unproject(arrowHead1), dirPoint.latLng, map.unproject(arrowHead2)]; 256 | } 257 | }); 258 | 259 | L$1.Symbol.arrowHead = function (options) { 260 | return new L$1.Symbol.ArrowHead(options); 261 | }; 262 | 263 | L$1.Symbol.Marker = L$1.Class.extend({ 264 | options: { 265 | markerOptions: {}, 266 | rotate: false 267 | }, 268 | 269 | initialize: function initialize(options) { 270 | L$1.Util.setOptions(this, options); 271 | this.options.markerOptions.clickable = false; 272 | this.options.markerOptions.draggable = false; 273 | }, 274 | 275 | buildSymbol: function buildSymbol(directionPoint, latLngs, map, index, total) { 276 | if (this.options.rotate) { 277 | this.options.markerOptions.rotationAngle = directionPoint.heading + (this.options.angleCorrection || 0); 278 | } 279 | return L$1.marker(directionPoint.latLng, this.options.markerOptions); 280 | } 281 | }); 282 | 283 | L$1.Symbol.marker = function (options) { 284 | return new L$1.Symbol.Marker(options); 285 | }; 286 | 287 | var isCoord = function isCoord(c) { 288 | return c instanceof L$1.LatLng || Array.isArray(c) && c.length === 2 && typeof c[0] === 'number'; 289 | }; 290 | 291 | var isCoordArray = function isCoordArray(ll) { 292 | return Array.isArray(ll) && isCoord(ll[0]); 293 | }; 294 | 295 | L$1.PolylineDecorator = L$1.FeatureGroup.extend({ 296 | options: { 297 | patterns: [] 298 | }, 299 | 300 | initialize: function initialize(paths, options) { 301 | L$1.FeatureGroup.prototype.initialize.call(this); 302 | L$1.Util.setOptions(this, options); 303 | this._map = null; 304 | this._paths = this._initPaths(paths); 305 | this._bounds = this._initBounds(); 306 | this._patterns = this._initPatterns(this.options.patterns); 307 | }, 308 | 309 | /** 310 | * Deals with all the different cases. input can be one of these types: 311 | * array of LatLng, array of 2-number arrays, Polyline, Polygon, 312 | * array of one of the previous. 313 | */ 314 | _initPaths: function _initPaths(input, isPolygon) { 315 | var _this = this; 316 | 317 | if (isCoordArray(input)) { 318 | // Leaflet Polygons don't need the first point to be repeated, but we do 319 | var coords = isPolygon ? input.concat([input[0]]) : input; 320 | return [coords]; 321 | } 322 | if (input instanceof L$1.Polyline) { 323 | // we need some recursivity to support multi-poly* 324 | return this._initPaths(input.getLatLngs(), input instanceof L$1.Polygon); 325 | } 326 | if (Array.isArray(input)) { 327 | // flatten everything, we just need coordinate lists to apply patterns 328 | return input.reduce(function (flatArray, p) { 329 | return flatArray.concat(_this._initPaths(p, isPolygon)); 330 | }, []); 331 | } 332 | return []; 333 | }, 334 | 335 | // parse pattern definitions and precompute some values 336 | _initPatterns: function _initPatterns(patternDefs) { 337 | return patternDefs.map(this._parsePatternDef); 338 | }, 339 | 340 | /** 341 | * Changes the patterns used by this decorator 342 | * and redraws the new one. 343 | */ 344 | setPatterns: function setPatterns(patterns) { 345 | this.options.patterns = patterns; 346 | this._patterns = this._initPatterns(this.options.patterns); 347 | this.redraw(); 348 | }, 349 | 350 | /** 351 | * Changes the patterns used by this decorator 352 | * and redraws the new one. 353 | */ 354 | setPaths: function setPaths(paths) { 355 | this._paths = this._initPaths(paths); 356 | this._bounds = this._initBounds(); 357 | this.redraw(); 358 | }, 359 | 360 | /** 361 | * Parse the pattern definition 362 | */ 363 | _parsePatternDef: function _parsePatternDef(patternDef, latLngs) { 364 | return { 365 | symbolFactory: patternDef.symbol, 366 | // Parse offset and repeat values, managing the two cases: 367 | // absolute (in pixels) or relative (in percentage of the polyline length) 368 | offset: parseRelativeOrAbsoluteValue(patternDef.offset), 369 | endOffset: parseRelativeOrAbsoluteValue(patternDef.endOffset), 370 | repeat: parseRelativeOrAbsoluteValue(patternDef.repeat) 371 | }; 372 | }, 373 | 374 | onAdd: function onAdd(map) { 375 | this._map = map; 376 | this._draw(); 377 | this._map.on('moveend', this.redraw, this); 378 | }, 379 | 380 | onRemove: function onRemove(map) { 381 | this._map.off('moveend', this.redraw, this); 382 | this._map = null; 383 | L$1.FeatureGroup.prototype.onRemove.call(this, map); 384 | }, 385 | 386 | /** 387 | * As real pattern bounds depends on map zoom and bounds, 388 | * we just compute the total bounds of all paths decorated by this instance. 389 | */ 390 | _initBounds: function _initBounds() { 391 | var allPathCoords = this._paths.reduce(function (acc, path) { 392 | return acc.concat(path); 393 | }, []); 394 | return L$1.latLngBounds(allPathCoords); 395 | }, 396 | 397 | getBounds: function getBounds() { 398 | return this._bounds; 399 | }, 400 | 401 | /** 402 | * Returns an array of ILayers object 403 | */ 404 | _buildSymbols: function _buildSymbols(latLngs, symbolFactory, directionPoints) { 405 | var _this2 = this; 406 | 407 | return directionPoints.map(function (directionPoint, i) { 408 | return symbolFactory.buildSymbol(directionPoint, latLngs, _this2._map, i, directionPoints.length); 409 | }); 410 | }, 411 | 412 | /** 413 | * Compute pairs of LatLng and heading angle, 414 | * that define positions and directions of the symbols on the path 415 | */ 416 | _getDirectionPoints: function _getDirectionPoints(latLngs, pattern) { 417 | var _this3 = this; 418 | 419 | if (latLngs.length < 2) { 420 | return []; 421 | } 422 | var pathAsPoints = latLngs.map(function (latLng) { 423 | return _this3._map.project(latLng); 424 | }); 425 | return projectPatternOnPointPath(pathAsPoints, pattern).map(function (point) { 426 | return { 427 | latLng: _this3._map.unproject(L$1.point(point.pt)), 428 | heading: point.heading 429 | }; 430 | }); 431 | }, 432 | 433 | redraw: function redraw() { 434 | if (!this._map) { 435 | return; 436 | } 437 | this.clearLayers(); 438 | this._draw(); 439 | }, 440 | 441 | /** 442 | * Returns all symbols for a given pattern as an array of FeatureGroup 443 | */ 444 | _getPatternLayers: function _getPatternLayers(pattern) { 445 | var _this4 = this; 446 | 447 | var mapBounds = this._map.getBounds().pad(0.1); 448 | return this._paths.map(function (path) { 449 | var directionPoints = _this4._getDirectionPoints(path, pattern) 450 | // filter out invisible points 451 | .filter(function (point) { 452 | return mapBounds.contains(point.latLng); 453 | }); 454 | return L$1.featureGroup(_this4._buildSymbols(path, pattern.symbolFactory, directionPoints)); 455 | }); 456 | }, 457 | 458 | /** 459 | * Draw all patterns 460 | */ 461 | _draw: function _draw() { 462 | var _this5 = this; 463 | 464 | this._patterns.map(function (pattern) { 465 | return _this5._getPatternLayers(pattern); 466 | }).forEach(function (layers) { 467 | _this5.addLayer(L$1.featureGroup(layers)); 468 | }); 469 | } 470 | }); 471 | /* 472 | * Allows compact syntax to be used 473 | */ 474 | L$1.polylineDecorator = function (paths, options) { 475 | return new L$1.PolylineDecorator(paths, options); 476 | }; 477 | 478 | }))); 479 | 480 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | ## creative commons 2 | 3 | # Attribution-ShareAlike 4.0 International 4 | 5 | Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. 6 | 7 | ### Using Creative Commons Public Licenses 8 | 9 | Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. 10 | 11 | * __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors). 12 | 13 | * __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees). 14 | 15 | ## Creative Commons Attribution-ShareAlike 4.0 International Public License 16 | 17 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. 18 | 19 | ### Section 1 – Definitions. 20 | 21 | a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. 22 | 23 | b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. 24 | 25 | c. __BY-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License. 26 | 27 | d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 28 | 29 | e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. 30 | 31 | f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. 32 | 33 | g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike. 34 | 35 | h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License. 36 | 37 | i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. 38 | 39 | j. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License. 40 | 41 | k. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. 42 | 43 | l. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. 44 | 45 | m. __You__ means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. 46 | 47 | ### Section 2 – Scope. 48 | 49 | a. ___License grant.___ 50 | 51 | 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: 52 | 53 | A. reproduce and Share the Licensed Material, in whole or in part; and 54 | 55 | B. produce, reproduce, and Share Adapted Material. 56 | 57 | 2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 58 | 59 | 3. __Term.__ The term of this Public License is specified in Section 6(a). 60 | 61 | 4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 62 | 63 | 5. __Downstream recipients.__ 64 | 65 | A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. 66 | 67 | B. __Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. 68 | 69 | C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 70 | 71 | 6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). 72 | 73 | b. ___Other rights.___ 74 | 75 | 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 76 | 77 | 2. Patent and trademark rights are not licensed under this Public License. 78 | 79 | 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. 80 | 81 | ### Section 3 – License Conditions. 82 | 83 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 84 | 85 | a. ___Attribution.___ 86 | 87 | 1. If You Share the Licensed Material (including in modified form), You must: 88 | 89 | A. retain the following if it is supplied by the Licensor with the Licensed Material: 90 | 91 | i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); 92 | 93 | ii. a copyright notice; 94 | 95 | iii. a notice that refers to this Public License; 96 | 97 | iv. a notice that refers to the disclaimer of warranties; 98 | 99 | v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 100 | 101 | B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and 102 | 103 | C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 104 | 105 | 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 106 | 107 | 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 108 | 109 | b. ___ShareAlike.___ 110 | 111 | In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. 112 | 113 | 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License. 114 | 115 | 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. 116 | 117 | 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. 118 | 119 | ### Section 4 – Sui Generis Database Rights. 120 | 121 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: 122 | 123 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; 124 | 125 | b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and 126 | 127 | c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. 128 | 129 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. 130 | 131 | ### Section 5 – Disclaimer of Warranties and Limitation of Liability. 132 | 133 | a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__ 134 | 135 | b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__ 136 | 137 | c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. 138 | 139 | ### Section 6 – Term and Termination. 140 | 141 | a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. 142 | 143 | b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 144 | 145 | 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 146 | 147 | 2. upon express reinstatement by the Licensor. 148 | 149 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. 150 | 151 | c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. 152 | 153 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 154 | 155 | ### Section 7 – Other Terms and Conditions. 156 | 157 | a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. 158 | 159 | b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.t stated herein are separate from and independent of the terms and conditions of this Public License. 160 | 161 | ### Section 8 – Interpretation. 162 | 163 | a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. 164 | 165 | b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. 166 | 167 | c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. 168 | 169 | d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. 170 | 171 | ``` 172 | Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. 173 | 174 | Creative Commons may be contacted at creativecommons.org 175 | ``` 176 | -------------------------------------------------------------------------------- /public/resources/leaflet.js: -------------------------------------------------------------------------------- 1 | /* @preserve 2 | * Leaflet 1.5.1+Detached: 2e3e0ffbe87f246eb76d86d2633ddd59b262830b.2e3e0ff, a JS library for interactive maps. http://leafletjs.com 3 | * (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade 4 | */ 5 | !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(t.L={})}(this,function(t){"use strict";var i=Object.freeze;function h(t){var i,e,n,o;for(e=1,n=arguments.length;e=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>=i.x&&n.x<=e.x,r=o.y>=i.y&&n.y<=e.y;return s&&r},overlaps:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>i.x&&n.xi.y&&n.y=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=i.lat&&n.lat<=e.lat,r=o.lng>=i.lng&&n.lng<=e.lng;return s&&r},overlaps:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>i.lat&&n.lati.lng&&n.lng';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}();function kt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Bt=(Object.freeze||Object)({ie:it,ielt9:et,edge:nt,webkit:ot,android:st,android23:rt,androidStock:ht,opera:ut,chrome:lt,gecko:ct,safari:_t,phantom:dt,opera12:pt,win:mt,ie3d:ft,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:xt,mobileWebkit:wt,mobileWebkit3d:Pt,msPointer:Lt,pointer:bt,touch:Tt,mobileOpera:zt,mobileGecko:Mt,retina:Ct,canvas:St,svg:Zt,vml:Et}),At=Lt?"MSPointerDown":"pointerdown",It=Lt?"MSPointerMove":"pointermove",Ot=Lt?"MSPointerUp":"pointerup",Rt=Lt?"MSPointerCancel":"pointercancel",Nt=["INPUT","SELECT","OPTION"],Dt={},jt=!1,Wt=0;function Ht(t,i,e,n){return"touchstart"===i?function(t,i,e){var n=a(function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Nt.indexOf(t.target.tagName)<0))return;Di(t)}qt(t,i)});t["_leaflet_touchstart"+e]=n,t.addEventListener(At,n,!1),jt||(document.documentElement.addEventListener(At,Ft,!0),document.documentElement.addEventListener(It,Ut,!0),document.documentElement.addEventListener(Ot,Vt,!0),document.documentElement.addEventListener(Rt,Vt,!0),jt=!0)}(t,e,n):"touchmove"===i?function(t,i,e){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&qt(t,i)};t["_leaflet_touchmove"+e]=n,t.addEventListener(It,n,!1)}(t,e,n):"touchend"===i&&function(t,i,e){var n=function(t){qt(t,i)};t["_leaflet_touchend"+e]=n,t.addEventListener(Ot,n,!1),t.addEventListener(Rt,n,!1)}(t,e,n),this}function Ft(t){Dt[t.pointerId]=t,Wt++}function Ut(t){Dt[t.pointerId]&&(Dt[t.pointerId]=t)}function Vt(t){delete Dt[t.pointerId],Wt--}function qt(t,i){for(var e in t.touches=[],Dt)t.touches.push(Dt[e]);t.changedTouches=[t],i(t)}var Gt=Lt?"MSPointerDown":bt?"pointerdown":"touchstart",Kt=Lt?"MSPointerUp":bt?"pointerup":"touchend",Yt="_leaflet_";function Xt(t,o,i){var s,r,a=!1;function e(t){var i;if(bt){if(!nt||"mouse"===t.pointerType)return;i=Wt}else i=t.touches.length;if(!(1this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),n=this._limitCenter(e,this._zoom,D(t));return e.equals(n)||this.panTo(n,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=I((i=i||{}).paddingTopLeft||i.padding||[0,0]),n=I(i.paddingBottomRight||i.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),h=a.getSize().divideBy(2),u=R([a.min.add(e),a.max.subtract(n)]);if(!u.contains(r)){this._enforcingBounds=!0;var l=s.subtract(r),c=I(r.x+l.x,r.y+l.y);(r.xu.max.x)&&(c.x=s.x-l.x,0u.max.y)&&(c.y=s.y-l.y,0=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,n=[],o="mouseout"===i||"mouseover"===i,s=t.target||t.srcElement,r=!1;s;){if((e=this._targets[u(s)])&&("click"===i||"preclick"===i)&&!t._simulated&&this._draggableMoved(e)){r=!0;break}if(e&&e.listens(i,!0)){if(o&&!Ki(s,t))break;if(n.push(e),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Ki(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Gi(t)){var i=t.type;"mousedown"!==i&&"keypress"!==i&&"keyup"!==i&&"keydown"!==i||zi(t.target||t.srcElement),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){if("click"===t.type){var n=h({},t);n.type="preclick",this._fireDOMEvent(n,n.type,e)}if(!t._stopped&&(e=(e||[]).concat(this._findEventTargets(t,i))).length){var o=e[0];"contextmenu"===i&&o.listens(i,!0)&&Di(t);var s={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var r=o.getLatLng&&(!o._radius||o._radius<=10);s.containerPoint=r?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),s.layerPoint=this.containerPointToLayerPoint(s.containerPoint),s.latlng=r?o.getLatLng():this.layerPointToLatLng(s.layerPoint)}for(var a=0;athis.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(o))&&(M(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,n){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,pi(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:n}),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&mi(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),M(function(){this._moveEnd(!0)},this))}});function $i(t){return new Qi(t)}var Qi=Z.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),n=t._controlCorners[e];return pi(i,"leaflet-control"),-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ui(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",n=document.createElement("div");return n.innerHTML=e,n.firstChild},_addItem:function(t){var i,e=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=n):i=this._createRadioElement("leaflet-base-layers_"+u(this),n),this._layerControlInputs.push(i),i.layerId=u(t.layer),Ei(i,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return e.appendChild(s),s.appendChild(i),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;0<=s;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;si.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ie=Qi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=hi("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){var s=hi("a",e,n);return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),Ni(s),Ei(s,"click",ji),Ei(s,"click",o,this),Ei(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";mi(this._zoomInButton,i),mi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMinZoom()||pi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMaxZoom()||pi(this._zoomInButton,i)}});Ji.mergeOptions({zoomControl:!0}),Ji.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ie,this.addControl(this.zoomControl))});var ee=Qi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=hi("div",i),n=this.options;return this._addScales(n,i+"-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=hi("div",i,e)),t.imperial&&(this._iScale=hi("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,e=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t),e=i<1e3?i+" m":i/1e3+" km";this._updateScale(this._mScale,e,i/t)},_updateImperial:function(t){var i,e,n,o=3.2808399*t;5280Leaflet'},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=hi("div","leaflet-control-attribution"),Ni(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t=[];for(var i in this._attributions)this._attributions[i]&&t.push(i);var e=[];this.options.prefix&&e.push(this.options.prefix),t.length&&e.push(t.join(", ")),this._container.innerHTML=e.join(" | ")}}});Ji.mergeOptions({attributionControl:!0}),Ji.addInitHook(function(){this.options.attributionControl&&(new ne).addTo(this)});Qi.Layers=te,Qi.Zoom=ie,Qi.Scale=ee,Qi.Attribution=ne,$i.layers=function(t,i,e){return new te(t,i,e)},$i.zoom=function(t){return new ie(t)},$i.scale=function(t){return new ee(t)},$i.attribution=function(t){return new ne(t)};var oe=Z.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}});oe.addTo=function(t,i){return t.addHandler(i,this),this};var se,re={Events:E},ae=Tt?"touchstart mousedown":"mousedown",he={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},ue={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},le=k.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){p(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(Ei(this._dragStartTarget,ae,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(le._dragging===this&&this.finishDrag(),Bi(this._dragStartTarget,ae,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!di(this._element,"leaflet-zoom-anim")&&!(le._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((le._dragging=this)._preventOutline&&zi(this._element),bi(),$t(),this._moving)))){this.fire("down");var i=t.touches?t.touches[0]:t,e=Ci(this._element);this._startPoint=new B(i.clientX,i.clientY),this._parentScale=Si(e),Ei(document,ue[t.type],this._onMove,this),Ei(document,he[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&1i.max.x&&(e|=2),t.yi.max.y&&(e|=8),e}function fe(t,i,e,n){var o,s=i.x,r=i.y,a=e.x-s,h=e.y-r,u=a*a+h*h;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(u=!u);return u||De.prototype._containsPoint.call(this,t,!0)}});var We=Ee.extend({initialize:function(t,i){p(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=v(t)?t:t.features;if(o){for(i=0,e=o.length;iu.x&&(l=s.x+n-u.x+h.x),s.x-l-a.x<0&&(l=s.x-a.x),s.y+e+h.y>u.y&&(c=s.y+e-u.y+h.y),s.y-c-a.y<0&&(c=s.y-a.y),(l||c)&&t.fire("autopanstart").panBy([l,c])}},_onCloseButtonClick:function(t){this._close(),ji(t)},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Ji.mergeOptions({closePopupOnClick:!0}),Ji.include({openPopup:function(t,i,e){return t instanceof nn||(t=new nn(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Se.include({bindPopup:function(t,i){return t instanceof nn?(p(t,i),(this._popup=t)._source=this):(this._popup&&!i||(this._popup=new nn(i,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,i){return this._popup&&this._map&&(i=this._popup._prepareOpen(this,t,i),this._map.openPopup(this._popup,i)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i=t.layer||t.target;this._popup&&this._map&&(ji(t),i instanceof Oe?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===i?this.closePopup():this.openPopup(i,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var on=en.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){en.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){en.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=en.prototype.getEvents.call(this);return Tt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=hi("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i=this._map,e=this._container,n=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(t),s=this.options.direction,r=e.offsetWidth,a=e.offsetHeight,h=I(this.options.offset),u=this._getAnchor();t="top"===s?t.add(I(-r/2+h.x,-a+h.y+u.y,!0)):"bottom"===s?t.subtract(I(r/2-h.x,-h.y,!0)):"center"===s?t.subtract(I(r/2+h.x,a/2-u.y+h.y,!0)):"right"===s||"auto"===s&&o.xthis.options.maxZoom||ethis.options.maxZoom||void 0!==this.options.minZoom&&oe.max.x)||!i.wrapLat&&(t.ye.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return D(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),o=n.add(e);return[i.unproject(n,t.z),i.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var i=this._tileCoordsToNwSe(t),e=new N(i[0],i[1]);return this.options.noWrap||(e=this._map.wrapLatLngBounds(e)),e},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),e=new B(+i[0],+i[1]);return e.z=+i[2],e},_removeTile:function(t){var i=this._tiles[t];i&&(ui(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){pi(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=l,t.onmousemove=l,et&&this.options.opacity<1&&vi(t,this.options.opacity),st&&!rt&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,i){var e=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),a(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(a(this._tileReady,this,t,null,o)),wi(o,e),this._tiles[n]={el:o,coords:t,current:!0},i.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var n=this._tileCoordsToKey(t);(e=this._tiles[n])&&(e.loaded=+new Date,this._map._fadeAnimated?(vi(e.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(pi(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new B(this._wrapX?r(t.x,this._wrapX):t.x,this._wrapY?r(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new O(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var an=rn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,i){this._url=t,(i=p(this,i)).detectRetina&&Ct&&0')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),pn={_initContainer:function(){this._container=hi("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ln.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=dn("shape");pi(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=dn("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;ui(i),t.removeInteractiveTarget(i),delete this._layers[u(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i||(i=t._stroke=dn("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=v(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e||(e=t._fill=dn("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){ci(t._container)},_bringToBack:function(t){_i(t._container)}},mn=Et?dn:$,fn=ln.extend({getEvents:function(){var t=ln.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=mn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=mn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ui(this._container),Bi(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){ln.prototype._update.call(this);var t=this._bounds,i=t.getSize(),e=this._container;this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),wi(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update")}},_initPath:function(t){var i=t._path=mn("path");t.options.className&&pi(i,t.options.className),t.options.interactive&&pi(i,"leaflet-interactive"),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ui(t._path),t.removeInteractiveTarget(t._path),delete this._layers[u(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,e=t.options;i&&(e.stroke?(i.setAttribute("stroke",e.color),i.setAttribute("stroke-opacity",e.opacity),i.setAttribute("stroke-width",e.weight),i.setAttribute("stroke-linecap",e.lineCap),i.setAttribute("stroke-linejoin",e.lineJoin),e.dashArray?i.setAttribute("stroke-dasharray",e.dashArray):i.removeAttribute("stroke-dasharray"),e.dashOffset?i.setAttribute("stroke-dashoffset",e.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),e.fill?(i.setAttribute("fill",e.fillColor||e.color),i.setAttribute("fill-opacity",e.fillOpacity),i.setAttribute("fill-rule",e.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,Q(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,o)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){ci(t._path)},_bringToBack:function(t){_i(t._path)}});function gn(t){return Zt||Et?new fn(t):null}Et&&fn.include(pn),Ji.include({getRenderer:function(t){var i=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return i||(i=this._renderer=this._createRenderer()),this.hasLayer(i)||this.addLayer(i),i},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&_n(t)||gn(t)}});var vn=je.extend({initialize:function(t,i){je.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=D(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});fn.create=mn,fn.pointsToPath=Q,We.geometryToLayer=He,We.coordsToLatLng=Fe,We.coordsToLatLngs=Ue,We.latLngToCoords=Ve,We.latLngsToCoords=qe,We.getFeature=Ge,We.asFeature=Ke,Ji.mergeOptions({boxZoom:!0});var yn=oe.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Ei(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Bi(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ui(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),$t(),bi(),this._startPoint=this._map.mouseEventToContainerPoint(t),Ei(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=hi("div","leaflet-zoom-box",this._container),pi(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new O(this._point,this._startPoint),e=i.getSize();wi(this._box,i.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ui(this._box),mi(this._container,"leaflet-crosshair")),Qt(),Ti(),Bi(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0);var i=new N(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(i).fire("boxzoomend",{boxZoomBounds:i})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Ji.addInitHook("addHandler","boxZoom",yn),Ji.mergeOptions({doubleClickZoom:!0});var xn=oe.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,o=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(o):i.setZoomAround(t.containerPoint,o)}});Ji.addInitHook("addHandler","doubleClickZoom",xn),Ji.mergeOptions({dragging:!0,inertia:!rt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var wn=oe.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new le(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}pi(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){mi(this._map._container,"leaflet-grab"),mi(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var i=D(this._map.options.maxBounds);this._offsetLimit=R(this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(i.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(e),this._times.push(i),this._prunePositions(i)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,s=(n+i+e)%t-i-e,r=Math.abs(o+e)i.getMaxZoom()&&1