Class: OGR::Writer

Inherits:
Object
  • Object
show all
Includes:
FFIOGR
Defined in:
lib/ffi-ogr/writer.rb

Constant Summary

Constants included from FFIOGR

FFIOGR::OGR_FUNCTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FFIOGR

find_lib, gdal_library_path, search_paths

Constructor Details

#initialize(driver_name) ⇒ Writer

Returns a new instance of Writer.



7
8
9
10
11
12
# File 'lib/ffi-ogr/writer.rb', line 7

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

#ptrObject

Returns the value of attribute ptr.



5
6
7
# File 'lib/ffi-ogr/writer.rb', line 5

def ptr
  @ptr
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/ffi-ogr/writer.rb', line 5

def type
  @type
end

Instance Method Details

#set_output(path, options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/ffi-ogr/writer.rb', line 14

def set_output(path, options={})
  path = File.expand_path(path)
  ds = OGR_Dr_CreateDataSource(@driver, path, nil)
  @ptr = OGR::Tools.cast_data_source(ds)
  @ptr
end