Class: Neo4j::Spatial::SHPImporter

Inherits:
Object
  • Object
show all
Includes:
Database, Listener
Defined in:
lib/neo4j/spatial/shp.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 = {}) ⇒ SHPImporter

Returns a new instance of SHPImporter.



14
15
16
17
# File 'lib/neo4j/spatial/shp.rb', line 14

def initialize(options={})
  database(options)
  @importer = org.neo4j.gis.spatial.ShapefileImporter.new(normal_database, self, @commit)
end

Instance Method Details

#import(shp_path, layer_name = nil) ⇒ Object



18
19
20
21
22
23
# File 'lib/neo4j/spatial/shp.rb', line 18

def import(shp_path,layer_name=nil)
  @shp_path = shp_path
  layer_name ||= shp_path.split(/[\\\/]+/)[-1].gsub(/\.\w+$/,'')
  puts "\n=== Loading layer #{layer_name} from #{shp_path} ==="
  @importer.import_file @shp_path, layer_name
end

#to_sObject



24
25
26
# File 'lib/neo4j/spatial/shp.rb', line 24

def to_s
  @shp_path.to_s
end