Module: GDAL::Dataset::ClassMethods
- Included in:
- GDAL::Dataset
- Defined in:
- lib/gdal/dataset/class_methods.rb
Instance Method Summary collapse
-
#copy_whole_raster(source, destination, options = {}, progress_function = nil) ⇒ Object
Copy all dataset raster data.
- #new_pointer(dataset, warn_on_nil: true) ⇒ FFI::AutoPointer
- #open(path, access_flag, shared: true) ⇒ Object
- #release(pointer) ⇒ Object
Instance Method Details
#copy_whole_raster(source, destination, options = {}, progress_function = nil) ⇒ Object
Copy all dataset raster data.
This function copies the complete raster contents of one dataset to another similarly configured dataset. The source and destination dataset must have the same number of bands, and the same width and height. The bands do not have to have the same data type.
This function is primarily intended to support implementation of driver specific CreateCopy() functions. It implements efficient copying, in particular “chunking” the copy in substantial blocks and, if appropriate, performing the transfer in a pixel interleaved fashion.
43 44 45 46 47 48 49 50 51 |
# File 'lib/gdal/dataset/class_methods.rb', line 43 def copy_whole_raster(source, destination, = {}, progress_function = nil) source_ptr = GDAL._pointer(GDAL::Dataset, source, autorelease: false) dest_ptr = GDAL._pointer(GDAL::Dataset, destination, autorelease: false) = GDAL::Options.pointer() GDAL::CPLErrorHandler.manually_handle("Unable to copy whole raster") do FFI::GDAL::GDAL.GDALDatasetCopyWholeRaster(source_ptr, dest_ptr, , progress_function, nil) end end |
#new_pointer(dataset, warn_on_nil: true) ⇒ FFI::AutoPointer
55 56 57 58 59 |
# File 'lib/gdal/dataset/class_methods.rb', line 55 def new_pointer(dataset, warn_on_nil: true) ptr = GDAL._pointer(GDAL::Dataset, dataset, warn_on_nil: warn_on_nil, autorelease: false) FFI::AutoPointer.new(ptr, Dataset.method(:release)) end |
#open(path, access_flag, shared: true) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gdal/dataset/class_methods.rb', line 11 def open(path, access_flag, shared: true) ds = new(path, access_flag, shared_open: shared) if block_given? result = yield ds ds.close result else ds end end |