Sha256: 19423ba4b6dac1d677cf82331bd1d314c2d65b1292f61c21c1b98410546bc353

Contents?: true

Size: 500 Bytes

Versions: 8

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

class Map::Gdal::TilesService
  include Map::Gdal::Base

  DEFAULT_ZOOM_MAX = 15

  def initialize(file)
    @file = file
  end

  def call(options = {})
    tiles_folder = options[:output] || File.join(Dir.tmpdir, "tiles-#{(Time.current.to_i * rand).to_i}")

    run_command("gdal2tiles.py --profile=mercator -z #{options[:zoom_min].to_i}-#{options[:zoom_max] || DEFAULT_ZOOM_MAX} #{@file} #{tiles_folder}")

    add_to_clean(tiles_folder)

    tiles_folder
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aqila-mapas-0.4.12 lib/map/gdal/tiles_service.rb
aqila-mapas-0.4.11 lib/map/gdal/tiles_service.rb
aqila-mapas-0.4.9 lib/map/gdal/tiles_service.rb
aqila-mapas-0.4.8 lib/map/gdal/tiles_service.rb
aqila-mapas-0.4.7 lib/map/gdal/tiles_service.rb
aqila-mapas-0.4.6 lib/map/gdal/tiles_service.rb
aqila-mapas-0.4.5 lib/map/gdal/tiles_service.rb
aqila-mapas-0.4.4 lib/map/gdal/tiles_service.rb