Method: Travertine.tile_coordinates_for_zoom

Defined in:
lib/travertine.rb

.tile_coordinates_for_zoom(zoom_level) ⇒ Object

Calculates the tile grid for a given zoom level.

Parameters:

zoom_level: The level of zoom to compute the tile grid for.

Returns:

An Array of 2-element Arrays representing the tile x,y coordinates. For example, the tile grid at zoom 1 is [[0,0,], [0,1], [1,0], [1,1]]



61
62
63
64
65
66
67
68
69
# File 'lib/travertine.rb', line 61

def self.tile_coordinates_for_zoom(zoom_level)
  [].tap do |coords|
    (0..((2 ** zoom_level) - 1)).each do |x|
      (0..((2 ** zoom_level) - 1)).each do |y|
        coords << [x,y]
      end
    end
  end
end