Skip to content

Instantly share code, notes, and snippets.

@mort
Created May 10, 2010 08:19
Show Gist options
  • Save mort/395808 to your computer and use it in GitHub Desktop.
Save mort/395808 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'csquares'
require 'geohash'
class TileMaker
def self.make(lat_min = 0.0, lon_min = 0.0, lat_max = 90.0, lon_max = 180.0, step = 0.0001)
lat = lat_min
lon = lon_min
[1.0,-1.0].each do |m|
lat = lat*m
lon = lon*m
while lat < lat_max
while lon < lon_max
csquare = CSquare.new(lat,lon)
geohash = GeoHash.encode(lat,lon)
puts "#{lat},#{lon}, #{csquare.code}, #{geohash}"
lon = lon + step
end
lat = lat + step
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment