Class: Map::Gdal::Ogr2ogrService
- Inherits:
-
Object
- Object
- Map::Gdal::Ogr2ogrService
- Includes:
- Base
- Defined in:
- lib/map/gdal/ogr2ogr_service.rb
Overview
ogr2ogr - Converts simple features data between file formats. www.gdal.org/ogr2ogr.html
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Attributes included from Base
Instance Method Summary collapse
- #call(options) ⇒ Object
-
#initialize(file) ⇒ Ogr2ogrService
constructor
A new instance of Ogr2ogrService.
Methods included from Base
#add_to_clean, #clean, #gdal_running?, #get_file_name_with_path, #get_layer_name, #get_path_to_temp_file, #options_to_command_line, #run_command, #store_kml, #tmp_file
Constructor Details
#initialize(file) ⇒ Ogr2ogrService
Returns a new instance of Ogr2ogrService.
8 9 10 11 |
# File 'lib/map/gdal/ogr2ogr_service.rb', line 8 def initialize(file) raise 'File does not exist' unless File.exist?(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/map/gdal/ogr2ogr_service.rb', line 7 def file @file end |
Instance Method Details
#call(options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/map/gdal/ogr2ogr_service.rb', line 13 def call() raise 'File does no exist' unless File.exist?(file) raise 'Format does not specified' unless [:f] out = get_path_to_temp_file(:ogr2ogr, [:f]) add_to_clean(out) run_command(%{ogr2ogr #{()} "#{out}" "#{file}"}) out end |