always add OSM source, switch when no google maps key is present.

This commit is contained in:
Jakob Ketterl 2020-03-13 23:53:14 +01:00
parent 3852f28fd4
commit ede40e4a68

View File

@ -215,20 +215,7 @@
case "config":
var config = json.value;
if (!map) $.getScript("https://maps.googleapis.com/maps/api/js?key=" + config.google_maps_api_key).done(function(){
if (config.google_maps_api_key){
map = new google.maps.Map($('.openwebrx-map')[0], {
center: {
lat: config.receiver_gps[0],
lng: config.receiver_gps[1]
},
zoom: 5
});
} else {
var mapTypeIds = [];
for(var type in google.maps.MapTypeId) {
mapTypeIds.push(google.maps.MapTypeId[type]);
}
mapTypeIds.push("OSM");
var mapTypeId = config.google_maps_api_key ? 'roadmap' : 'OSM';
map = new google.maps.Map($('.openwebrx-map')[0], {
center: {
@ -236,7 +223,7 @@
lng: config.receiver_gps[1]
},
zoom: 5,
mapTypeId: "OSM"
mapTypeId: mapTypeId
});
map.mapTypes.set("OSM", new google.maps.ImageMapType({
@ -247,7 +234,7 @@
name: "OpenStreetMap",
maxZoom: 18
}));
}
$.getScript("static/lib/nite-overlay.js").done(function(){
nite.init(map);
setInterval(function() { nite.refresh() }, 10000); // every 10s