4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/generators/map_tool/grid_generator.rb', line 4
def create_squares
config = LayersOfLondon::Booth::MapTool.configuration
squares_y = config.squares_y
squares_x = config.squares_x
north_west = config.north_west
row_north_west = north_west
squares_y.times do |row|
puts "Creating row #{row}"
square_north_west = row_north_west
square = nil
squares_x.times do |col|
puts "\tCreating column #{col}"
square = LayersOfLondon::Booth::MapTool::Square.create(north_west_lat: square_north_west.lat, north_west_lng: square_north_west.lng, row: row, col: col)
square_north_west = square.north_east
end
row_north_west = LayersOfLondon::Booth::MapTool::Square.find_by(row: row, col: 0).south_west
end
end
|