LoRaWAN-Signal-Mapping/client_src/js/MapManager.mjs

32 lines
749 B
JavaScript

"use strict";
import Config from './ClientConfig.mjs';
import GetFromUrl from './Helpers/GetFromUrl.mjs';
import L from 'leaflet';
class MapManager {
constructor() {
}
async setup() {
let index = JSON.parse(await GetFromUrl(Config.ai_index_file));
console.log(index);
this.map = L.map("map", {
fullscreenControl: true
});
this.map.setView(Config.default_location, Config.default_zoom);
// Add the OpenStreetMap tile layer
this.layer_openstreet = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
id: "openstreetmap",
maxZoom: 19,
attribution: "&copy; <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap contributors</a>"
}).addTo(this.map);
}
}
export default MapManager;