Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic Layers crash when minZoom or maxZoom specified

See original GitHub issue

This may be related to, which is marked as resolved, but I’m seeing this using the demo below, which uses Leaflet 1.0.3 and EsriLeaflet 2.0.7

When using minZoom or maxZoom on a Dynamic Layer, I’m seeing a fatal error. To reproduce:

  • zoom in until the States layer becomes visible at level 7
  • zoom out to level 8 so it switches off
  • pan the map

I’m seeing Uncaught TypeError: Cannot read property 'removeLayer' of null, and the map becomes unresponsive to further panning.

  <meta charset=utf-8 />
  <title>Simple DynamicMapLayer</title>
  <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

  <!-- Load Leaflet from CDN-->
  <link rel="stylesheet" href="" />
  <script src=""></script>

  <!-- Load Esri Leaflet from CDN -->
  <script src=""></script>

    body { margin:0; padding:0; }
    #map { position: absolute; top:20; bottom:0; right:0; left:0; }
  <span id="zoom">Zoom in until the States become visible at level 7, then zoom out, and pan</span>
  <div id="map"></div>
  var map ='map').setView([37.71, -99.88], 4);

  map.on("zoomend", function(){
    document.getElementById("zoom").innerHTML = "Current zoom level is " + this.getZoom();


    url: '',
    layers: [5],
    useCors: false,
    minZoom: 7


Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

jgravoiscommented, Mar 21, 2017

this fix is included in v2.0.8

jordanparfittcommented, Jun 3, 2022

My bower file was just jacked up. It works great. Thanks for the quick response.

On Fri, May 19, 2017 at 12:32 PM, john gravois wrote:

Did the nullify part get inserted into 2.0.8?

yup. its here

i just retested @slead’s repro case here (and yours in #910 (comment) with v2.0.8 and everything looked fine to me. if you are seeing errors, please feel free to log a new issue. i’d be happy to check into it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change dynamically created layer's minZoom after render
I tried couple of things: map.getLayer('my_custom_layer'); // this gets the layer map.getLayer('my_custom_layer ...
Read more >
Memory issue when trying to use minZoom on XYZ source
maxZoom works just fine. I was originally using OpenLayers in React, but after running into this issue, I stripped it down as much...
Read more >
Improve the performance of Mapbox GL JS maps | Help
Add explicit minzoom and maxzoom values to style layers to prevent filters from being used for evaluation at zoom levels where all geometries...
Read more >
freedog - .. - mapbox-gl - - GitLab
Fixed a bug where ImageSource and dynamically loaded icons didn't work in ... Now you can directly mutate the minzoom and maxzoom layer...
Read more >
Controlling Zoom and Pan | Maps JavaScript API
The usage of a map on a web page may require specific options to control the ... such as gestureHandling , minZoom ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found