Class: GDAL::Utils::Translate
- Inherits:
-
Object
- Object
- GDAL::Utils::Translate
- Defined in:
- lib/gdal/utils/translate.rb,
lib/gdal/utils/translate/options.rb
Overview
Wrapper for gdal_translate using GDALTranslate C API.
Defined Under Namespace
Classes: Options
Class Method Summary collapse
-
.perform(dst_dataset_path:, src_dataset:, options: Options.new) {|GDAL::Dataset| ... } ⇒ GDAL::Dataset
Perform the gdal_translate (GDALTranslate) operation.
Class Method Details
.perform(dst_dataset_path:, src_dataset:, options: Options.new) {|GDAL::Dataset| ... } ⇒ GDAL::Dataset
Perform the gdal_translate (GDALTranslate) operation.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/gdal/utils/translate.rb', line 56 def self.perform(dst_dataset_path:, src_dataset:, options: Options.new, &block) result_code_ptr = ::FFI::MemoryPointer.new(:int) dst_dataset_ptr = ::FFI::GDAL::Utils.GDALTranslate( dst_dataset_path, src_dataset.c_pointer, .c_pointer, result_code_ptr ) success = result_code_ptr.read_int.zero? raise ::GDAL::Error, "GDALTranslate failed." if dst_dataset_ptr.null? || !success ::GDAL::Dataset.open(dst_dataset_ptr, "w", &block) end |