title: How to fit map to tile layer bounds in leaflet
body: <p><br>
  I have a leaflet map. The map container is very big compared to the tile in first zoom level (256px X 256px). I want to get the bounds of tile and fit the map bounds to it. I am able to <code>fitbound()</code> with multiple markers. I adopted the code from <a href="http://jsfiddle.net/deciob/vVdyM/26/" rel="nofollow">here</a> . I tried to achieve fit to tile also with same idea. unfortunately it doesn't seem working. Here is my code</p>
  
  <pre><code>     var fitToBounds = function () {
           //getting bound of tile 256X256 pixel
          var maxLat = map.unproject(new L.Point(0,0)).lat; 
          var maxLat = map.unproject(new L.Point(0,256)).lat;
          var maxLng = map.unproject(new L.Point(256,0)).lng;
          var minLng = map.unproject(new L.Point(256,256)).lng;
          var southWest = new L.LatLng(minLat, minLng);
          var northEast = new L.LatLng(maxLat, maxLng);
          map.fitBounds(new L.LatLngBounds(southWest, northEast));
      };
  </code></pre>