module Geoloader::Assets::Geotiff

Public Instance Methods

make_borders_transparent() click to toggle source

Remove the black borders added by ArcMap.

# File lib/geoloader/assets/geotiff.rb, line 12
def make_borders_transparent
  gdal_command("gdalwarp -srcnodata 0 -dstalpha", @file_name)
end
reproject() click to toggle source

(Re)build a EPSG:4326 header.

# File lib/geoloader/assets/geotiff.rb, line 19
def reproject
  srs = Geoloader.config.geoserver.srs
  gdal_command("gdal_translate -of GTiff -a_srs #{srs}", @file_name)
end

Private Instance Methods

gdal_command(command, file_path) click to toggle source

Run a gdal command on a file, replacing the original file.

@param [String] command @param [String] file_path

# File lib/geoloader/assets/geotiff.rb, line 32
def gdal_command(command, file_path)
  `#{command} #{file_path} #{file_path}_`
  FileUtils.rm(file_path)
  FileUtils.mv("#{file_path}_", file_path)
end