neo4j-spatial 0.0.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/CONTRIBUTORS +5 -0
- data/Gemfile +15 -0
- data/README.rdoc +55 -0
- data/examples/export_layer.rb +54 -0
- data/examples/map.osm +6470 -0
- data/examples/map2.osm +131867 -0
- data/examples/osm_import.rb +29 -0
- data/examples/osm_layer.rb +55 -0
- data/examples/test.rb +92 -0
- data/lib/neo4j/spatial/cmd.rb +37 -0
- data/lib/neo4j/spatial/database.rb +85 -0
- data/lib/neo4j/spatial/image.rb +54 -0
- data/lib/neo4j/spatial/jars/gt-main/gt-api-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-main/gt-main-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-main/jdom-1.0.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-main/jts-1.11.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-main/xercesImpl-2.4.0.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/gt-coverage-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/gt-cql-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/gt-render-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/imageio-ext-tiff-1.0.7.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/imageio-ext-utilities-1.0.7.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/jai_codec-1.1.3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/jai_core-1.1.3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-render/jai_imageio-1.1.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/commons-pool-1.5.4.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/geoapi-2.3-M1.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/geoapi-pending-2.3-M1.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/gt-data-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/gt-metadata-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/gt-referencing-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/gt-shapefile-2.7-M3.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/jsr-275-1.0-beta-2.jar +0 -0
- data/lib/neo4j/spatial/jars/gt-shapefile/vecmath-1.3.2.jar +0 -0
- data/lib/neo4j/spatial/jars/json-simple-1.1.jar +0 -0
- data/lib/neo4j/spatial/jars/log4j-1.2.14.jar +0 -0
- data/lib/neo4j/spatial/jars/neo4j-spatial-0.3-SNAPSHOT.jar +0 -0
- data/lib/neo4j/spatial/layer.rb +60 -0
- data/lib/neo4j/spatial/listener.rb +29 -0
- data/lib/neo4j/spatial/osm.rb +52 -0
- data/lib/neo4j/spatial/shapefile.rb +50 -0
- data/lib/neo4j/spatial/version.rb +5 -0
- data/lib/neo4j/spatial.rb +56 -0
- data/neo4j-spatial.gemspec +31 -0
- metadata +158 -0
data/CHANGELOG
ADDED
data/CONTRIBUTORS
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source :gemcutter
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group 'test' do
|
6
|
+
gem "rake", ">= 0.8.7"
|
7
|
+
gem "rdoc", ">= 2.5.10"
|
8
|
+
gem "horo", ">= 1.0.2"
|
9
|
+
gem "rspec", ">= 2.0.0"
|
10
|
+
gem "test-unit"
|
11
|
+
end
|
12
|
+
|
13
|
+
#gem 'ruby-debug-base19' if RUBY_VERSION.include? "1.9"
|
14
|
+
#gem 'ruby-debug-base' if RUBY_VERSION.include? "1.8"
|
15
|
+
#gem "ruby-debug-ide"
|
data/README.rdoc
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
== Welcome to neo4j-spatial.rb
|
2
|
+
|
3
|
+
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.
|
4
|
+
|
5
|
+
For more information on the underlying components refer to:
|
6
|
+
* {Neo4J}[http://www.neo4j.org] - for persistence and traversal of the graph
|
7
|
+
* {Neo4J.rb}[http://github.com/andreasronge/neo4j] - for Ruby API to Neo4j
|
8
|
+
* {Neo4j-Spatial}[http://github.com/neo4j/neo4j-spatial] - for loading, indexing and analysing spatial data
|
9
|
+
|
10
|
+
=== Why Neo4j-Spatial.rb ?
|
11
|
+
|
12
|
+
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.
|
13
|
+
|
14
|
+
=== Documentation
|
15
|
+
|
16
|
+
.. to be done ..
|
17
|
+
|
18
|
+
=== Installation
|
19
|
+
|
20
|
+
Two options:
|
21
|
+
* As a RubyGem: jruby -S gem install neo4j-spatial
|
22
|
+
* From source: git clone git@github.com:craigtaverner/neo4j-spatial.rb.git
|
23
|
+
|
24
|
+
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.
|
25
|
+
|
26
|
+
=== Some Examples
|
27
|
+
|
28
|
+
.. to be done ..
|
29
|
+
(or see the code in the command-line utilities described below for examples)
|
30
|
+
|
31
|
+
=== Command-line utilities
|
32
|
+
|
33
|
+
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:
|
34
|
+
|
35
|
+
git clone git@github.com:craigtaverner/neo4j-spatial.rb.git
|
36
|
+
cd neo4j-spatial.rb/examples
|
37
|
+
jruby osm_import.rb map2.osm
|
38
|
+
jruby osm_layer.rb map2.osm highway highway-residential waterway natural natural-water
|
39
|
+
jruby osm_layer.rb -l
|
40
|
+
jruby export_layer.rb highway-residential
|
41
|
+
jruby export_layer.rb -F shp highway-residential natural
|
42
|
+
|
43
|
+
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.
|
44
|
+
|
45
|
+
=== Contributing
|
46
|
+
|
47
|
+
Have you found a bug, need help or have a patch ?
|
48
|
+
Just clone neo4j-spatial.rb and send me a pull request or email me.
|
49
|
+
Do you need help - mail the neo4j or neo4j.rb mailing lists.
|
50
|
+
|
51
|
+
=== License
|
52
|
+
|
53
|
+
* Neo4j and Neo4j-Spatial - Dual free software/commercial license, see http://neo4j.org/
|
54
|
+
* Neo4j.rb - MIT, see the LICENSE file http://github.com/andreasronge/neo4j/tree/master/LICENSE.
|
55
|
+
* Lucene - Apache, see http://lucene.apache.org/java/docs/features.html
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
# useful if being run inside a source code checkout
|
4
|
+
$: << 'lib'
|
5
|
+
$: << '../lib'
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'neo4j/spatial'
|
9
|
+
require 'neo4j/spatial/cmd'
|
10
|
+
|
11
|
+
$args = Neo4j::Spatial::Cmd.args
|
12
|
+
|
13
|
+
if $list === 'layers'
|
14
|
+
layers = Neo4j::Spatial::Layer.list
|
15
|
+
puts "Have #{layers.length} existing layers in the database:"
|
16
|
+
layers.each {|l| puts "\t#{l} (#{l.type_name})"}
|
17
|
+
puts
|
18
|
+
exit 0
|
19
|
+
end
|
20
|
+
|
21
|
+
if $help || $args.length < 1
|
22
|
+
puts <<-eos
|
23
|
+
|
24
|
+
usage: ./export_layer.rb <-D storage_path> <-F format> <-E dir> <-l> <-h> layer <layers>
|
25
|
+
-D Use specified database location
|
26
|
+
-F Use specified export format (png, shp)
|
27
|
+
-E Use specified export directory path (default '.')
|
28
|
+
-l List existing database layers first
|
29
|
+
-h Display this help and exit
|
30
|
+
The layer(s) should be pre-existing layers (including dynamic layers) in the database.
|
31
|
+
Supported formats are 'shp' for ESRI Shapefile and 'png' for images.
|
32
|
+
|
33
|
+
For example:
|
34
|
+
./export_layer.rb -D db -E exports -F png croatia.osm highway highway-residential natural-water
|
35
|
+
|
36
|
+
This will export four previously defined layers to png format files in the 'exports' directory.
|
37
|
+
|
38
|
+
eos
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
if $format.to_s === 'shp'
|
43
|
+
$exporter = Neo4j::Spatial::ShapefileExporter.new :dir => $export
|
44
|
+
else
|
45
|
+
$exporter = Neo4j::Spatial::ImageExporter.new :dir => $export
|
46
|
+
end
|
47
|
+
|
48
|
+
puts "Exporting #{$args.length} layers to #{$exporter.format}"
|
49
|
+
|
50
|
+
$args.each do |layer|
|
51
|
+
l = Neo4j::Spatial::Layer.find layer
|
52
|
+
puts "Exporting #{l} (#{l.type_name}) - #{l.index.layer_bounding_box}"
|
53
|
+
$exporter.export l.name
|
54
|
+
end
|