I am tring to get l.controls like layers, copyright or draw into panel/div like:

<div class="panel">
 <div id="layers">...HERE LAYERS...</div>
 <div id="copyright">...HERE COPYRIGHTS...</div>

So my question is, how to define new position or function that will get layers into panel/div?


1 Answer 1


I'm not sure to get your point, but:

In leaflet, the map view (where layers are) is set by this javascript instruction:

var mymap = L.map('divmap').setView([51.505, -0.09], 13);

where divmap is the id of the div where there is the map view. So you can put this <div id='divmap'></div> wherever you want in your page.

For the copyright (or attribution), you can set a different position than the default one using the setPosition method (http://leafletjs.com/reference-1.0.2.html#control), e.g., to put it in the top right corner of the map:


or try to set an absolute position by overriding the CSS class 'leaflet-control-attribution' (not tested).


  • I want to get L.controls (f.e. L.control.layers(baseMaps, overlayMaps).addTo(map);) not into corners (positions topleft, topright, bottomleft, bottomright), but into my element div (f.e. <div id="layers"></div>)... I dont want to use default positions, I want to define new positions - but I dont know how - or somehow get L.control into my elements Jan 9, 2017 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.