Leaflet WMS 2

by Leo

HTML

<script src="//rawgit.com/gorshkov-leonid/Leaflet/master/dist/leaflet-src.js"></script>
<link rel="stylesheet" href="//rawgit.com/gorshkov-leonid/Leaflet/master/dist/leaflet.css">
<body>
<div id="map" ></div>
</body>

CSS

html, body, #map {
        margin: 0;
        width: 100%;
        height: 100%;
}

JavaScript

var map = new L.Map('map'
            //,{
            //    center: new L.LatLng(45.5 + 0.003,-73.5 + 0.003),
            //    zoom: 16
            //}
);

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);

map.addEventListener('moveend', function(e){ 
    console.log("moveend " + e.target.getZoom() + ", " + e.target.getBounds().getSouthWest() + " - " + e.target.getBounds().getNorthEast()); 
});

/*
map.fitBounds([
    [59.87,30.19],
    [59.97,30.44]
]);
*/
map.fitBounds(L.latLngBounds(L.latLng(59.87,30.19), L.latLng(59.97,30.44)));