Class: Map::Gdal::TilesService
- Inherits:
-
Object
- Object
- Map::Gdal::TilesService
- Includes:
- Base
- Defined in:
- lib/map/gdal/tiles_service.rb
Constant Summary collapse
- DEFAULT_ZOOM_MAX =
15
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
-
#initialize(file) ⇒ TilesService
constructor
A new instance of TilesService.
Methods included from Base
#add_to_clean, #clean, #gdal_running?, #get_file_name_with_path, #get_layer_name, #get_path_to_temp_file, #options_to_command_line, #run_command, #store_kml, #tmp_file
Constructor Details
#initialize(file) ⇒ TilesService
Returns a new instance of TilesService.
8 9 10 |
# File 'lib/map/gdal/tiles_service.rb', line 8 def initialize(file) @file = file end |
Instance Method Details
#call(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/map/gdal/tiles_service.rb', line 12 def call( = {}) tiles_folder = [:output] || File.join(Dir.tmpdir, "tiles-#{(Time.current.to_i * rand).to_i}") run_command("gdal2tiles.py --profile=mercator -z #{[:zoom_min].to_i}-#{[:zoom_max] || DEFAULT_ZOOM_MAX} #{@file} #{tiles_folder}") add_to_clean(tiles_folder) tiles_folder end |