avoid unnecessary unkown layer enable

This commit is contained in:
Dave Conway-Jones 2019-04-02 10:28:26 +01:00
parent ad992245be
commit 13b2dc0e04
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -930,7 +930,6 @@ function setMarker(data) {
delMarker(data.name);
return;
}
delete data.action;
var ll;
var lli = null;
var opt = {};
@ -959,6 +958,7 @@ function setMarker(data) {
}
var lay = data.layer || "unknown";
if (data.hasOwnProperty("action") && data.action.indexOf("layer") === -1) {
if (typeof layers[lay] == "undefined") { // add layer if if doesn't exist
if (clusterAt > 0) {
layers[lay] = new L.MarkerClusterGroup({
@ -978,6 +978,8 @@ function setMarker(data) {
map.addLayer(overlays[lay]);
//console.log("ADDED LAYER",lay,layers);
}
}
delete data.action;
if (typeof markers[data.name] != "undefined") {
if (markers[data.name].lay !== data.layer) {
@ -1034,7 +1036,6 @@ function setMarker(data) {
layers[lay].addLayer(polycirc);
}
}
//console.log("handling",data.name);
if (typeof data.coordinates == "object") { ll = new L.LatLng(data.coordinates[1],data.coordinates[0]); }
else if (data.hasOwnProperty("position") && data.position.hasOwnProperty("lat") && data.position.hasOwnProperty("lon")) {
data.lat = data.position.lat*1;