Skip to content

Commit

Permalink
Update GDAL command to use built COG output format
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed Sep 30, 2024
1 parent e8fb60f commit 468ac5b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/derivative_services/geo_derivatives/processors/gdal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ def self.compress(in_path, out_path, options)
# @param out_path [String] processor output file path
# @param options [Hash] creation options
def self.cloud_optimized_geotiff(in_path, out_path, _options)
system("gdaladdo -q -r average \"#{in_path}\" 2 4 8 16 32")
execute("gdal_translate -q -expand rgb \"#{in_path}\" #{out_path} -ot Byte -co TILED=YES "\
"-a_nodata 256 -co COMPRESS=LZW -co COPY_SRC_OVERVIEWS=YES")
execute("gdal_translate -q -expand rgb \"#{in_path}\" #{out_path} -ot Byte -of COG "\
"-a_nodata 256 -co COMPRESS=JPEG")
rescue StandardError
# Try without expanding rgb
execute("gdal_translate -q \"#{in_path}\" #{out_path} -ot Byte -co TILED=YES "\
"-a_nodata 256 -co COMPRESS=LZW -co COPY_SRC_OVERVIEWS=YES")
execute("gdal_translate -q \"#{in_path}\" #{out_path} -ot Byte -of COG "\
"-a_nodata 256 -co COMPRESS=JPEG")
end

# Executes a gdal_rasterize command. Used to rasterize vector
Expand Down

0 comments on commit 468ac5b

Please sign in to comment.