Class: Neo4j::Spatial::ShapefileExporter
- Inherits:
-
Object
- Object
- Neo4j::Spatial::ShapefileExporter
- Includes:
- Database
- Defined in:
- lib/neo4j/spatial/shapefile.rb
Overview
This class facilitates importing datasets in the ESRI Shapefile format
Instance Method Summary collapse
- #export(layer_name, options = {}) ⇒ Object
- #format ⇒ Object
-
#initialize(options = {}) ⇒ ShapefileExporter
constructor
A new instance of ShapefileExporter.
- #to_s ⇒ Object
Methods included from Database
#batch_inserter, #database, #list_all, #normal_database, #spatial
Constructor Details
#initialize(options = {}) ⇒ ShapefileExporter
Returns a new instance of ShapefileExporter.
30 31 32 33 34 35 |
# File 'lib/neo4j/spatial/shapefile.rb', line 30 def initialize(={}) [:dir] ||= "target/export" database() @exporter = org.neo4j.gis.spatial.ShapefileExporter.new(@db.graph) @exporter.setExportDir([:dir]) end |
Instance Method Details
#export(layer_name, options = {}) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/neo4j/spatial/shapefile.rb', line 36 def export(layer_name,={}) @layer_name = layer_name [:path] ||= layer_name+'.shp' puts "Exporting #{layer_name} to #{[:path]}" @exporter.exportLayer(layer_name, [:path]) end |
#format ⇒ Object
42 43 44 |
# File 'lib/neo4j/spatial/shapefile.rb', line 42 def format "ESRI Shapefile" end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/neo4j/spatial/shapefile.rb', line 45 def to_s @layer_name || format end |