Some time when refreshing the page I am getting this error in chrome:
Uncaught TypeError: Cannot read property '_leaflet_id' of undefined leaflet.js:6
(anonymous function) leaflet.js:6
n.Map.n.Class.extend.hasLayer leaflet.js:6
domController.map.manageZoom domController.leaflet.js:647
n.Mixin.Events.fireEvent leaflet.js:6
n.Map.n.Class.extend._resetView leaflet.js:6
n.Map.include.n.DomUtil.TRANSITION._onZoomTransitionEnd leaflet.js:6
n.Map.include.n.DomUtil.TRANSITION._catchTransitionEnd leaflet.js:6
e.(anonymous function).u
this happen when:
if (!map.hasLayer(tilelayer)) {}
Any idea why this is happening and how to solve it?
When this happens the map gets unusable until refresh.
This happens when tilelayer
variable is undefined at the moment when this line executes. Put a debugger statement there and figure it out, shouldn't be hard.
Thank you.
Hi,
I'm having the same problem with Leaflet 1.0 Beta. I got this error:
Uncaught TypeError: Cannot read property '_leaflet_id' of undefined
on this line:
obj._leaflet_id = obj._leaflet_id || ++L.Util.lastId;
on stamp function
Can you help me with this please?. I created a new ticket (https://github.com/Leaflet/Leaflet/issues/3877)
这个问题一般是由于你用addLayer(tileLayer)时,这个tileLayer值为null引起的,检查一下tileLayer的初始化是否正确
Most helpful comment
This happens when
tilelayer
variable is undefined at the moment when this line executes. Put a debugger statement there and figure it out, shouldn't be hard.