Files
votianng/html/locating/map.js
2026-03-29 10:34:57 +02:00

53 lines
1.9 KiB
JavaScript

// Examples taken from:
// http://leafletjs.com/examples/quick-start/
// http://openwebcc.github.io/lv/examples/index.html
// https://meggsimum.de/?p=86
// http://stackoverflow.com/questions/9394190/leaflet-map-api-with-google-satellite-layer
var baseMaps = {
osm_de : L.tileLayer("https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png", {
attribution : '<a href="http://www.openstreetmap.org/">Karte hergestellt aus OpenStreetMap-Daten</a> | Lizenz: <a rel="license" href="http://opendatacommons.org/licenses/odbl/">Open Database License (ODbL)</a>'
}),
osm : L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap contributors</a>'
}),
osm_bw : L.tileLayer('https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap contributors</a>'
})
// oepnv : L.tileLayer("http://tile.xn--pnvkarte-m4a.de/tilegen/{z}/{x}/{y}.png", {
// attribution: 'Map data &copy; <a href="http://www.openstreetmap.org/">OpenStreetMap</a> and contributors <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
// }),
};
var map = L.map('map', {
center: homeCoords,
zoom: homeZoom,
layers : [baseMaps.osm_de].concat(defaultLayers)
});
var layerControl = L.control.layers({
"OSM Mapnik german style" : baseMaps.osm_de,
"OSM Mapnik" : baseMaps.osm,
"OSM Mapnik B&W" : baseMaps.osm_bw
// "&Ouml;PNV Karte" : baseMaps.oepnv,
},
overlayMaps
).addTo(map);
L.control.scale({
'imperial': false
}).addTo(map);
L.control.coordinates().addTo(map);
map.on('popupopen', onPopupOpen);
//// http://www.liedman.net/leaflet-routing-machine/tutorials/basic-usage/
//L.Routing.control({
// waypoints: [
// L.latLng(53.626, 9.838),
// L.latLng(53.80777, 10.14576)
// ],
// routeWhileDragging: false
//}).addTo(map);