diff options
-rw-r--r-- | src/leaflet-soton.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index 36650e4..830b0ee 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -785,9 +785,13 @@ SELECT * WHERE {\ workstationMarkerLayer = LS.workstationLayer(); LS.on("workstationData", function(data) { - map.removeLayer(workstationMarkerLayer); - workstationMarkerLayer = LS.workstationLayer(); - map.addLayer(workstationMarkerLayer); + if (map.hasLayer(workstationMarkerLayer)) { + map.removeLayer(workstationMarkerLayer); + workstationMarkerLayer = LS.workstationLayer(); + map.addLayer(workstationMarkerLayer); + } else { + workstationMarkerLayer = LS.workstationLayer(); + } }); } |