Dynamic Layers crash when minZoom or maxZoom specified
See original GitHub issueThis may be related to https://github.com/Esri/esri-leaflet/issues/910, 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.
<html>
<head>
<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="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet-src.js"></script>
<!-- Load Esri Leaflet from CDN -->
<script src="https://unpkg.com/esri-leaflet@2.0.7"></script>
<style>
body { margin:0; padding:0; }
#map { position: absolute; top:20; bottom:0; right:0; left:0; }
</style>
</head>
<body>
<span id="zoom">Zoom in until the States become visible at level 7, then zoom out, and pan</span>
<div id="map"></div>
<script>
var map = L.map('map').setView([37.71, -99.88], 4);
map.on("zoomend", function(){
document.getElementById("zoom").innerHTML = "Current zoom level is " + this.getZoom();
})
L.esri.basemapLayer('Gray').addTo(map);
L.esri.dynamicMapLayer({
url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/',
layers: [5],
useCors: false,
minZoom: 7
}).addTo(map);
</script>
</body>
</html>
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (7 by maintainers)
Top 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 - CHANGELOG.md - 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this fix is included in
v2.0.8
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 notifications@github.com wrote: