lib/cloudmade/tiles.rb
def latlon2tilenums(lat, lon, zoom)
      factor = 2**(zoom - 1)
      lat = radians(lat)
      lon = radians(lon)
      xtile = 1 + lon / Math::PI
      ytile = 1 - Math.log(Math.tan(lat) + (1 / Math.cos(lat))) / Math::PI
      return Point.new((xtile * factor).to_i, (ytile * factor).to_i)
    end
def latlon2tilenums(lat, lon, zoom)
      factor = 2**(zoom - 1)
      lat = radians(lat)
      lon = radians(lon)
      xtile = 1 + lon / Math::PI
      ytile = 1 - Math.log(Math.tan(lat) + (1 / Math.cos(lat))) / Math::PI
      return Point.new((xtile * factor).to_i, (ytile * factor).to_i)
    end
Convert latitude, longitude pair to tile coordinates. Returns tile coordinates as a CloudMade::Point object
 * +lat+ Latitude
 * +lon+ Longitude
 * +zoom+ Zoom level