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