Neo4j is a graph database for Java, Neo4j.rb is a graph database for JRuby using Neo4j internally. Neo4j-spatial.rb is a wrapper on Neo4j.rb that includes all the Java dependencies to enable spatial analysis, and includes some Ruby wrappers to access the spatial utilities.
For more information on the underlying components refer to:
-
Neo4J - for persistence and traversal of the graph
-
Neo4J.rb - for Ruby API to Neo4j
-
Neo4j-Spatial - for loading, indexing and analysing spatial data
When we wrote Neo4j-spatial we found that while it had many capabilities, most users did not know about them. The lack of articles, blogs and examples made the code a little unapproachable. This Ruby wrapper was originally written to support writing blogs about some of the interesting use cases that are possible with Neo4j-Spatial, but the decision to base it on Andreas Ronges excellent Neo4j.rb library also means that it can be used in a much wider context, including Rails application.
.. to be done ..
Two options:
-
As a RubyGem: jruby -S gem install neo4j-spatial
-
From source: git clone [email protected]:craigtaverner/neo4j-spatial.rb.git
Take note that neo4j-spatial.rb requires that you install the neo4j gem for database access, and optionally the amanzi-sld gem (for advanced styling of the PNG exports). If you install neo4j-spatial as a rubygem, you should get these dependencies automatically, otherwise be sure to install them before running the examples below.
.. to be done .. (or see the code in the command-line utilities described below for examples)
The examples directory includes a few sample Ruby scripts for various import/export tasks, as well as some sample OSM data to test one. Consider the following run through:
git clone [email protected]:craigtaverner/neo4j-spatial.rb.git cd neo4j-spatial.rb/examples jruby osm_import.rb map2.osm jruby osm_layer.rb map2.osm highway highway-residential waterway natural natural-water jruby osm_layer.rb -l jruby export_layer.rb highway-residential jruby export_layer.rb -F shp highway-residential natural
Then take a look in the examples/target/export directory for the PNG and SHP files generated. Run each of the three utility commands with no arguments, or with -h, to see what options are available.
Have you found a bug, need help or have a patch ? Just clone neo4j-spatial.rb and send me a pull request or email me. Do you need help - mail the neo4j or neo4j.rb mailing lists.
-
Neo4j and Neo4j-Spatial - Dual free software/commercial license, see neo4j.org/
-
Neo4j.rb - MIT, see the LICENSE file github.com/andreasronge/neo4j/tree/master/LICENSE.
-
Lucene - Apache, see lucene.apache.org/java/docs/features.html