Class: Neo4j::Spatial::ShapefileImporter
- Inherits:
-
Object
- Object
- Neo4j::Spatial::ShapefileImporter
- Defined in:
- lib/neo4j/spatial/shapefile.rb
Overview
This class facilitates importing datasets in the ESRI Shapefile format
Instance Method Summary collapse
- #import(shp_path, layer_name = nil) ⇒ Object
-
#initialize(options = {}) ⇒ ShapefileImporter
constructor
A new instance of ShapefileImporter.
- #to_s ⇒ Object
Methods included from Database
#batch_inserter, #database, #list_all, #normal_database, #spatial
Methods included from Listener
#begin, #done, #progress, #worked
Constructor Details
#initialize(options = {}) ⇒ ShapefileImporter
Returns a new instance of ShapefileImporter.
13 14 15 16 |
# File 'lib/neo4j/spatial/shapefile.rb', line 13 def initialize(={}) database() @importer = org.neo4j.gis.spatial.ShapefileImporter.new(@db.graph, self, @commit) end |
Instance Method Details
#import(shp_path, layer_name = nil) ⇒ Object
17 18 19 20 21 |
# File 'lib/neo4j/spatial/shapefile.rb', line 17 def import(shp_path,layer_name=nil) @shp_path = shp_path layer_name ||= shp_path.split(/[\\\/]+/)[-1].gsub(/\.\w+$/,'') @importer.import_file @shp_path, layer_name end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/neo4j/spatial/shapefile.rb', line 22 def to_s @shp_path.to_s end |