title: Get bounds of map tile generated by mapbox
body: <p>I've a mobile application that requires the usage of offline maps for areas immediately around certain locations; the plan would be getting a mapbox tile and then surrounding tiles or something of the sort and then rendering them with Leaflet.</p>
  
  <p>This is a multi-part process; first, I use the single coordinate I have on the following Ruby method:</p>
  
  <pre><code>def get_tile_number(lat_deg, lng_deg, zoom)
    lat_rad = lat_deg/180 * Math::PI
    n = 2.0 ** zoom
    x = ((lng_deg + 180.0) / 360.0 * n).to_i
    y = ((1.0 - Math::log(Math::tan(lat_rad) + (1 / Math::cos(lat_rad))) / Math::PI) / 2.0 * n).to_i
    {:z =&gt; zoom, :x =&gt; x, :y =&gt;y}
  end
  </code></pre>
  
  <p>Which returns the x, y, z coordinates for a tile, which I can then feed into the mapbox API for a tile image, which I can then use as a source image for leaflet maps... But I don't have any information regarding the boundaries, so the map image can't be used properly.</p>
  
  <p>So, how can I get the information on the boundaries for that map? Is there an easier way of providing offline maps?</p>