Class: Neo4j::Spatial::OSMImporter

Inherits:
Object
  • Object
show all
Includes:
Database, Listener
Defined in:
lib/neo4j/spatial/osm.rb

Instance Method Summary collapse

Methods included from Database

#batch_inserter, #database, #list_all, #normal_database, #spatial

Methods included from Listener

#begin, #done, #progress, #worked

Constructor Details

#initialize(options = {}) ⇒ OSMImporter

Returns a new instance of OSMImporter.



110
111
112
# File 'lib/neo4j/spatial/osm.rb', line 110

def initialize(options={})
  database(options)
end

Instance Method Details

#import(osm_path, layer_name = nil) ⇒ Object



113
114
115
116
117
118
119
120
# File 'lib/neo4j/spatial/osm.rb', line 113

def import(osm_path,layer_name=nil)
  @osm_path = osm_path
  layer_name ||= osm_path.split(/[\\\/]+/)[-1]
  puts "\n=== Loading layer #{layer_name} from #{osm_path} ==="
  @importer = org.neo4j.gis.spatial.osm.OSMImporter.new(layer_name)
  @importer.import_file batch_inserter, @osm_path
  @importer.re_index normal_database, @commit
end

#to_sObject



121
122
123
# File 'lib/neo4j/spatial/osm.rb', line 121

def to_s
  @osm_path.to_s
end