Class: OGR::Reader
Constant Summary collapse
- TF_MAP =
{ true => 1, false => 0, 1 => true, 0 => false }
Constants included from FFIOGR
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(driver_name) ⇒ Reader
constructor
A new instance of Reader.
- #read(file_path, writeable = false) ⇒ Object
Methods included from FFIOGR
find_lib, gdal_library_path, search_paths
Constructor Details
#initialize(driver_name) ⇒ Reader
Returns a new instance of Reader.
14 15 16 17 18 19 |
# File 'lib/ffi-ogr/reader.rb', line 14 def initialize(driver_name) OGRRegisterAll() @driver = OGRGetDriverByName(driver_name) raise RuntimeError.new "Invalid driver name" if @driver.null? @type = driver_name end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/ffi-ogr/reader.rb', line 5 def type @type end |
Instance Method Details
#read(file_path, writeable = false) ⇒ Object
21 22 23 24 |
# File 'lib/ffi-ogr/reader.rb', line 21 def read(file_path, writeable=false) ds = OGR_Dr_Open(@driver, File.(file_path), TF_MAP[writeable]) OGR::Tools.cast_data_source(ds) end |