: <div id="map">div>
: <style> #map { height: 500px; width: 700px; } style>
area to the
after the map container div
. Also inside of this, you can create the map object by calling the map()
function of the leaflet object, like this: <script type='text/javascript'> var map = L.map('map'); </script>
map.setView([0, 0], 2);
var layer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }); layer.addTo(map);
element:
. var marker = L.marker([20, 20]); marker.addTo(map);
marker.bindPopup('Chad'); marker.openPopup();
var polyline = L.polyline([ [20, 10], [10, 20], [20, 30] ]) polyline.addTo(map);
polyline.setStyle({ color: 'red' });
var scale = L.control.scale() scale.addTo(map);