Sha256: 90827fbeeeabb7ce292d0931c2cef2152b6c30db49623d63bf5b61a3bde6be37

Contents?: true

Size: 1.45 KB

Versions: 17

Compression:

Stored size: 1.45 KB

Contents

module GeoConcerns
  module Processors
    module Raster
      class Aig < GeoConcerns::Processors::Raster::Base
        include GeoConcerns::Processors::Zip

        def self.encode(path, options, output_file)
          unzip(path, output_file) do |zip_path|
            info = Info.new(zip_path)
            options[:min_max] = info.min_max
            case options[:label]
            when :thumbnail
              encode_raster(zip_path, output_file, options)
            when :display_raster
              reproject_raster(zip_path, output_file, options)
            end
          end
        end

        # Set of commands to run to reproject the AIG.
        # @return [Array] set of command name symbols
        def self.reproject_queue
          [:warp, :translate]
        end

        # Executes a gdal_translate command to translate a raster
        # format into a different format with a scaling options. This command
        # scales the min and max values of the raster into the 0 to 255 range.
        # Scale is inverted (255 to 0) to create a better visualization.
        # @param in_path [String] file input path
        # @param out_path [String] processor output file path
        # @param options [Hash] creation options
        def self.translate(in_path, out_path, options)
          execute "gdal_translate -scale #{options[:min_max]} 255 0 "\
                    "-q -ot Byte -of GTiff \"#{in_path}\" #{out_path}"
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.3.3 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.3.2 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.3.1 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.3.0 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.2.0 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.1.1 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.1.0 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.10 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.9 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.8 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.7 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.6 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.5 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.4 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.3 app/processors/geo_concerns/processors/raster/aig.rb
geo_concerns-0.0.2 app/processors/geo_concerns/processors/raster/aig.rb