Module: Tairu

Extended by:
Tairu, Configuration
Included in:
Tairu
Defined in:
lib/tairu.rb,
lib/tairu/tile.rb,
lib/tairu/cache.rb,
lib/tairu/store.rb,
lib/tairu/server.rb,
lib/tairu/version.rb,
lib/tairu/store/tms.rb,
lib/tairu/cache/disk.rb,
lib/tairu/coordinate.rb,
lib/tairu/store/esri.rb,
lib/tairu/cache/memory.rb,
lib/tairu/configuration.rb,
lib/tairu/store/geojson.rb,
lib/tairu/store/mbtiles.rb,
lib/tairu/cache/redis_cache.rb

Defined Under Namespace

Modules: Cache, Configuration, Store Classes: Coordinate, Server, Tile

Constant Summary collapse

TILE_404 =
Tairu::Tile.new('', 'image/png')
VERSION =
'0.11.0'

Class Attribute Summary collapse

Attributes included from Configuration

#cache, #layers, #name, #tilesets

Class Method Summary collapse

Methods included from Configuration

add_layers, config_from_file, configure, configure_cache, configure_layers, configure_tilesets, start_cache

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



19
20
21
# File 'lib/tairu.rb', line 19

def logger
  @logger
end

Class Method Details

.get_tile(name, coord, format = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tairu.rb', line 21

def get_tile(name, coord, format=nil)
  tileset = Tairu.tilesets[name]

  return TILE_404 if tileset.nil?

  tile = Tairu.cache.get(name, coord)

  if tile.nil?
    tile = tileset.get(coord, Tairu.layers[name]['format'])
    unless tile.nil?
      Tairu.cache.add(name, coord, tile)
    else
      tile = TILE_404
    end
  end

  tile
end