Skip to content

Instantly share code, notes, and snippets.

@carmoreira
Last active August 3, 2023 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carmoreira/4af1a95ed0f285e666fac2bc49b862c1 to your computer and use it in GitHub Desktop.
Save carmoreira/4af1a95ed0f285e666fac2bc49b862c1 to your computer and use it in GitHub Desktop.
Show all overlay series after specific zoom level - Interactive Geo Maps
let mapID = 11111; // replace with your map ID
let igmNow = Date.now();
let igmZoomLevel = 3;
mapContainer.addEventListener('mapready', function(ev) {
let igmap = iMaps.maps[mapID].map;
igmap.events.on("zoomlevelchanged", function(ev) {
if( Date.now() >= igmNow + 500){
let series = iMaps.maps[mapID].series;
series.forEach(function(serie) {
if( iMaps.maps[mapID].allBaseSeries.includes( serie ) ){ return; }
if (igmap.zoomLevel >= igmZoomLevel) {
serie.show();
} else {
serie.hide();
}
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment