leaflet ยท console.warn
bindLeaflet: options.map has no {methods}();...
Printed by leaflet, prefixed [lattice], since 1.76.0.
Warnings reference › leaflet:map
- Identifier
leaflet:map- Raised by
- leaflet
- Since
- 1.76.0
What happened
The binding adds and removes its layers with the map's addLayer/removeLayer, listens for moveend/zoomend with on/off, and reads the view with getBounds(). The object passed as options.map lacks the methods named, so it is not a Leaflet L.Map (a common slip is passing the map's container element or its id). Nothing was bound: no listener, no layers, no filter.
The fix
Pass the map itself, as L.map(...) returns it.
The smallest fix
bindLeaflet(grid, { map: L.map('map').setView([51.5, -0.1], 11), layers, position: { lon: 'lon', lat: 'lat' } });
Reference
Covered in full at the API reference.