class GDAL::VirtualDataset

Attributes

c_pointer[R]

Public Class Methods

new(x_size, y_size) click to toggle source
# File lib/gdal/virtual_dataset.rb, line 12
def initialize(x_size, y_size)
  FFI::GDAL::VRT.GDALRegister_VRT
  @c_pointer = FFI::GDAL::VRT.VRTCreate(x_size, y_size)
end

Public Instance Methods

add_band(data_type, **options) click to toggle source

@param data_type [FFI::GDAL::GDAL::DataType] @param options [Hash] @return [Boolean]

# File lib/gdal/virtual_dataset.rb, line 31
def add_band(data_type, **options)
  options_ptr = GDAL::Options.pointer(options)

  FFI::GDAL::VRT.VRTAddBand(@c_pointer, data_type, options_ptr)
end
add_complex_source(vrt_band, source_band, no_data_value, src_x_offset: 0, src_y_offset: 0, src_x_size: nil, src_y_size: nil, dst_x_offset: 0, dst_y_offset: 0, dst_x_size: nil, dst_y_size: nil, scale_offset: 0.0, scale_ratio: 0.0) click to toggle source

@return [Boolean]

# File lib/gdal/virtual_dataset.rb, line 67
def add_complex_source(vrt_band, source_band, no_data_value,
  src_x_offset: 0, src_y_offset: 0, src_x_size: nil, src_y_size: nil,
  dst_x_offset: 0, dst_y_offset: 0, dst_x_size: nil, dst_y_size: nil,
  scale_offset: 0.0, scale_ratio: 0.0)
  FFI::GDAL::VRT.VRTAddComplexSource(
    vrt_band,
    source_band,      # hSrcBand
    src_x_offset,     # hSrcBand
    src_y_offset,     # hSrcBand
    src_x_size,       # hSrcBand
    src_y_size,       # hSrcBand
    dst_x_offset,     # hSrcBand
    dst_y_offset,     # hSrcBand
    dst_x_size,       # hSrcBand
    dst_y_size,       # hSrcBand
    scale_offset,     # dfScaleOff
    scale_ratio,      # dfScaleRatio
    no_data_value     # dfNoDataValue
  )
end
add_func_source(vrt_band, read_function, data, no_data_value) click to toggle source

@param vrt_band [FFI::Pointer] @param read_function [Proc] @param data [FFI::Pointer] @param no_data_value [Float] @return [Boolean]

# File lib/gdal/virtual_dataset.rb, line 94
def add_func_source(vrt_band, read_function, data, no_data_value)
  FFI::GDAL::VRT.VRTAddFuncSource(vrt_band, read_function, data, no_data_value)
end
add_simple_source(vrt_band, source_band, no_data_value, src_x_offset: 0, src_y_offset: 0, src_x_size: nil, src_y_size: nil, dst_x_offset: 0, dst_y_offset: 0, dst_x_size: nil, dst_y_size: nil, resampling: "") click to toggle source

rubocop:disable Metrics/ParameterLists @return [Boolean]

# File lib/gdal/virtual_dataset.rb, line 46
def add_simple_source(vrt_band, source_band, no_data_value,
  src_x_offset: 0, src_y_offset: 0, src_x_size: nil, src_y_size: nil,
  dst_x_offset: 0, dst_y_offset: 0, dst_x_size: nil, dst_y_size: nil,
  resampling: "")
  FFI::GDAL::VRT.VRTAddSimpleSource(
    vrt_band,
    source_band,      # hSrcBand
    src_x_offset,     # hSrcBand
    src_y_offset,     # hSrcBand
    src_x_size,       # hSrcBand
    src_y_size,       # hSrcBand
    dst_x_offset,     # hSrcBand
    dst_y_offset,     # hSrcBand
    dst_x_size,       # hSrcBand
    dst_y_size,       # hSrcBand
    resampling,       # pszResampling,
    no_data_value     # dfNoDataValue
  )
end
add_source(vrt_band, new_source) click to toggle source

@param vrt_band [FFI::Pointer] @param new_source [FFI::Pointer] @return [Boolean] [description]

# File lib/gdal/virtual_dataset.rb, line 40
def add_source(vrt_band, new_source)
  FFI::GDAL::VRT.VRTAddSource(vrt_band, new_source)
end
flush_cache() click to toggle source
# File lib/gdal/virtual_dataset.rb, line 17
def flush_cache
  FFI::GDAL::VRT.VRTFlushCache(@c_pointer)
end
to_xml(path = "") click to toggle source

TODO: Build the xml string

# File lib/gdal/virtual_dataset.rb, line 22
def to_xml(path = "")
  xml_node = FFI::GDAL::VRT.VRTSerializeToXML(@c_pointer, path)

  FFI::CPL::MiniXML.CPLSerializeXMLTree(xml_node)
end