# turns a spherical mercator coord into a tile coord
def self.tile_from_merc(point, zoom)
# turns a spherical mercator coord into a tile coord
def self.tile_from_merc(point, zoom)
# added, deleted or modified - the tile will need updating anyway.
doc.find("//node").each do |node|
lat = node["lat"].to_f
# added, deleted or modified - the tile will need updating anyway.
doc.find("//node").each do |node|
lat = node["lat"].to_f
point = Proj4::Point.new(Math::PI * node["lon"].to_f / 180,
Math::PI * lat / 180)
nodes[node["id"].to_i] = tile_from_latlon(point, max_zoom)
point = Proj4::Point.new(Math::PI * node["lon"].to_f / 180,
Math::PI * lat / 180)
nodes[node["id"].to_i] = tile_from_latlon(point, max_zoom)