You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My code is pretty much exactly copy-pasted from the docs' excerpts.
{%blockcontent%}{%leaflet_map'cadastre_map'callback="window.map_init"%}{%endblock%}{%blockhead%}{%leaflet_css%}{%leaflet_js%}
<script>
functionmap_init(map, options) {var lc =map.layerscontrol;// An example from the Atlas of Living Australia https://www.ala.org.au/lc.addOverlay(L.tileLayer.wms('https://spatial-beta.ala.org.au/geoserver/ALA/wms', { layers:'ALA:aus2', format:'image/png', transparent:true }),'Australia' ); }
</script>
{%endblock%}
I'd say it's from the documentation. There's no point in having a control if there is no layer. Maybe we should add that we need to create our own control in that case: var lc = L.control.layers().addTo(map);
Hi django-leaflet team,
I just installed django-leaflet and ran into an issue with a missing variable.
Context
I want to display a map with default values, and add an overlay layer. I followed the doc about adding overlays with js.
My code is pretty much exactly copy-pasted from the docs' excerpts.
In my settings:
Expected result
The overlay should display properly, according to the documentation.
Actual result
The console throws this error:
Uncaught TypeError: lc is undefined
It seems to me that, according to this line or this one, the line that defines the layersControl var is never reached if no layers or overlays are defined in django settings.
I'm not sure if this is a bug with django-leaflet or is something is missing from the documentation?
Thanks
The text was updated successfully, but these errors were encountered: