neo4j-spatial 0.0.2-java → 0.0.4-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/examples/export_layer.rb +8 -3
  2. data/examples/osm_layer.rb +22 -3
  3. data/lib/neo4j/spatial/cmd.rb +38 -20
  4. data/lib/neo4j/spatial/geometry.rb +40 -0
  5. data/lib/neo4j/spatial/image.rb +3 -3
  6. data/lib/neo4j/spatial/jars/antlr-2.7.7.jar +0 -0
  7. data/lib/neo4j/spatial/jars/antlr-3.2.jar +0 -0
  8. data/lib/neo4j/spatial/jars/antlr-runtime-3.2.jar +0 -0
  9. data/lib/neo4j/spatial/jars/asm-3.1.jar +0 -0
  10. data/lib/neo4j/spatial/jars/blueprints-0.3.jar +0 -0
  11. data/lib/neo4j/spatial/jars/collections-generic-4.01.jar +0 -0
  12. data/lib/neo4j/spatial/jars/colt-1.2.0.jar +0 -0
  13. data/lib/neo4j/spatial/jars/commons-beanutils-1.7.0.jar +0 -0
  14. data/lib/neo4j/spatial/jars/commons-beanutils-core-1.8.0.jar +0 -0
  15. data/lib/neo4j/spatial/jars/commons-collections-3.2.1.jar +0 -0
  16. data/lib/neo4j/spatial/jars/commons-configuration-1.6.jar +0 -0
  17. data/lib/neo4j/spatial/jars/commons-digester-1.8.jar +0 -0
  18. data/lib/neo4j/spatial/jars/commons-io-1.4.jar +0 -0
  19. data/lib/neo4j/spatial/jars/commons-lang-2.4.jar +0 -0
  20. data/lib/neo4j/spatial/jars/commons-logging-1.1.1.jar +0 -0
  21. data/lib/neo4j/spatial/jars/concurrent-1.3.4.jar +0 -0
  22. data/lib/neo4j/spatial/jars/geronimo-jta_1.1_spec-1.1.1.jar +0 -0
  23. data/lib/neo4j/spatial/jars/gremlin-0.6.jar +0 -0
  24. data/lib/neo4j/spatial/jars/jackson-core-asl-1.6.1.jar +0 -0
  25. data/lib/neo4j/spatial/jars/jackson-jaxrs-1.6.1.jar +0 -0
  26. data/lib/neo4j/spatial/jars/jackson-mapper-asl-1.6.1.jar +0 -0
  27. data/lib/neo4j/spatial/jars/jconsole.jar +0 -0
  28. data/lib/neo4j/spatial/jars/jersey-core-1.4.jar +0 -0
  29. data/lib/neo4j/spatial/jars/jersey-multipart-1.3.jar +0 -0
  30. data/lib/neo4j/spatial/jars/jersey-server-1.4.jar +0 -0
  31. data/lib/neo4j/spatial/jars/jetty-6.1.25.jar +0 -0
  32. data/lib/neo4j/spatial/jars/jetty-util-6.1.25.jar +0 -0
  33. data/lib/neo4j/spatial/jars/jung-algorithms-2.0.jar +0 -0
  34. data/lib/neo4j/spatial/jars/jung-api-2.0.jar +0 -0
  35. data/lib/neo4j/spatial/jars/junit-4.8.1.jar +0 -0
  36. data/lib/neo4j/spatial/jars/mimepull-1.4.jar +0 -0
  37. data/lib/neo4j/spatial/jars/neo4j-1.2.pom +250 -0
  38. data/lib/neo4j/spatial/jars/neo4j-graph-algo-0.7-1.2.jar +0 -0
  39. data/lib/neo4j/spatial/jars/neo4j-ha-0.5-1.2.jar +0 -0
  40. data/lib/neo4j/spatial/jars/neo4j-index-1.2-1.2.jar +0 -0
  41. data/lib/neo4j/spatial/jars/neo4j-kernel-1.2-1.2.jar +0 -0
  42. data/lib/neo4j/spatial/jars/neo4j-lucene-index-0.2-1.2.jar +0 -0
  43. data/lib/neo4j/spatial/jars/neo4j-management-1.2-1.2.jar +0 -0
  44. data/lib/neo4j/spatial/jars/neo4j-online-backup-0.7-1.2.jar +0 -0
  45. data/lib/neo4j/spatial/jars/neo4j-remote-graphdb-0.8-1.2.jar +0 -0
  46. data/lib/neo4j/spatial/jars/neo4j-server-0.5-1.2.jar +0 -0
  47. data/lib/neo4j/spatial/jars/neo4j-shell-1.2-1.2.jar +0 -0
  48. data/lib/neo4j/spatial/jars/neo4j-spatial-0.3-SNAPSHOT.jar +0 -0
  49. data/lib/neo4j/spatial/jars/neo4j-udc-0.1-1.2.jar +0 -0
  50. data/lib/neo4j/spatial/jars/netty-3.2.1.Final.jar +0 -0
  51. data/lib/neo4j/spatial/jars/org.apache.felix.fileinstall-3.0.2.jar +0 -0
  52. data/lib/neo4j/spatial/jars/org.apache.felix.framework-3.0.2.jar +0 -0
  53. data/lib/neo4j/spatial/jars/org.apache.felix.main-3.0.2.jar +0 -0
  54. data/lib/neo4j/spatial/jars/org.apache.servicemix.bundles.jline-0.9.94_1.jar +0 -0
  55. data/lib/neo4j/spatial/jars/org.apache.servicemix.bundles.lucene-3.0.1_2.jar +0 -0
  56. data/lib/neo4j/spatial/jars/org.osgi.compendium-4.1.0.jar +0 -0
  57. data/lib/neo4j/spatial/jars/org.osgi.core-4.1.0.jar +0 -0
  58. data/lib/neo4j/spatial/jars/pipes-0.2.jar +0 -0
  59. data/lib/neo4j/spatial/jars/protobuf-java-2.3.0.jar +0 -0
  60. data/lib/neo4j/spatial/jars/rrd4j-2.0.6.jar +0 -0
  61. data/lib/neo4j/spatial/jars/servlet-api-2.5-20081211.jar +0 -0
  62. data/lib/neo4j/spatial/jars/slf4j-api-1.5.10.jar +0 -0
  63. data/lib/neo4j/spatial/jars/slf4j-log4j12-1.5.10.jar +0 -0
  64. data/lib/neo4j/spatial/jars/stringtemplate-3.2.jar +0 -0
  65. data/lib/neo4j/spatial/jars/zookeeper-3.3.2.jar +0 -0
  66. data/lib/neo4j/spatial/layer.rb +9 -0
  67. data/lib/neo4j/spatial/osm.rb +22 -6
  68. data/lib/neo4j/spatial/version.rb +1 -1
  69. data/neo4j-spatial.gemspec +1 -1
  70. metadata +64 -4
@@ -8,6 +8,7 @@ require 'rubygems'
8
8
  require 'neo4j/spatial'
9
9
  require 'neo4j/spatial/cmd'
10
10
 
11
+ $zoom = 1.0
11
12
  $args = Neo4j::Spatial::Cmd.args
12
13
 
13
14
  if $list === 'layers'
@@ -21,10 +22,13 @@ end
21
22
  if $help || $args.length < 1
22
23
  puts <<-eos
23
24
 
24
- usage: ./export_layer.rb <-D storage_path> <-F format> <-E dir> <-l> <-h> layer <layers>
25
+ usage: ./export_layer.rb <-D storage_path> <-F format> <-E dir> <-Z zoom> <-W width> <-H height> <-l> <-h> layer <layers>
25
26
  -D Use specified database location
26
27
  -F Use specified export format (png, shp)
27
28
  -E Use specified export directory path (default '.')
29
+ -Z Zoom in by specified factor (eg. 3.0)
30
+ -W Image width (default 600)
31
+ -H Image height (default 400)
28
32
  -l List existing database layers first
29
33
  -h Display this help and exit
30
34
  The layer(s) should be pre-existing layers (including dynamic layers) in the database.
@@ -39,10 +43,10 @@ eos
39
43
  exit
40
44
  end
41
45
 
42
- if $format.to_s === 'shp'
46
+ if $format.to_s.downcase === 'shp'
43
47
  $exporter = Neo4j::Spatial::ShapefileExporter.new :dir => $export
44
48
  else
45
- $exporter = Neo4j::Spatial::ImageExporter.new :dir => $export
49
+ $exporter = Neo4j::Spatial::ImageExporter.new :dir => $export, :zoom => $zoom, :width => $width, :height => $height
46
50
  end
47
51
 
48
52
  puts "Exporting #{$args.length} layers to #{$exporter.format}"
@@ -51,4 +55,5 @@ $args.each do |layer|
51
55
  l = Neo4j::Spatial::Layer.find layer
52
56
  puts "Exporting #{l} (#{l.type_name}) - #{l.index.layer_bounding_box}"
53
57
  $exporter.export l.name
58
+ puts "Finished exporting #{l} (#{l.type_name}) of #{l.index.count} entries"
54
59
  end
@@ -13,16 +13,31 @@ $args = Neo4j::Spatial::Cmd.args
13
13
  if $list === 'layers'
14
14
  layers = Neo4j::Spatial::Layer.list
15
15
  puts "Have #{layers.length} existing layers in the database:"
16
- layers.each {|l| puts "\t#{l} (#{l.type_name})"}
16
+ layers.each {|l| puts "\t#{l.describe}"}
17
17
  puts
18
18
  exit 0
19
19
  end
20
20
 
21
+ if $exists
22
+ if $exists == true
23
+ $exists = $args.shift
24
+ end
25
+ if Neo4j::Spatial::Layer.exist?($exists)
26
+ puts "Layer '#{$exists}' exists"
27
+ exit 0
28
+ else
29
+ puts "Layer '#{$exists}' not found"
30
+ exit -1
31
+ end
32
+ end
33
+
21
34
  if $help || $args.length < 2
22
35
  puts <<-eos
23
36
 
24
- usage: ./osm_layer.rb <-D storage_path> <-l> <-h> layer layerspec <layerspecs>
37
+ usage: ./osm_layer.rb <-D storage_path> <-x> <-l> <-r> <-h> layer layerspec <layerspecs>
25
38
  -D Use specified database location
39
+ -x Test if specified layer exists (and exit)
40
+ -r Delete specified dynamic layer on specified osm layer
26
41
  -l List existing database layers
27
42
  -h Display this help and exit
28
43
  The layer should be a pre-existing OSM layer in the database created with OSM import.
@@ -51,5 +66,9 @@ end
51
66
  $args.each do |layerspec|
52
67
  x = layerspec.split(/[\.-]/) << nil
53
68
  x = x[0...(2*(x.length/2))] # allow only even number of entries
54
- $layer.add_dynamic_layer Hash[*x]
69
+ if $delete
70
+ $layer.remove_dynamic_layer Hash[*x]
71
+ else
72
+ $layer.add_dynamic_layer Hash[*x]
73
+ end
55
74
  end
@@ -7,27 +7,45 @@ module Neo4j
7
7
  def self.args
8
8
  @args=[]
9
9
  while( arg = ARGV.shift ) do
10
- if arg =~ /\-d/
11
- $delete = true
12
- elsif arg =~ /\-D/
13
- path = ARGV.shift
14
- if path && path.length > 0
15
- Neo4j::Config[:storage_path] = path
16
- else
17
- puts "Invalid database location: #{path}"
10
+ if arg =~ /^\-(\w+)/
11
+ $1.split.each do |field|
12
+ if field =~ /d/
13
+ $delete = true
14
+ elsif field =~ /D/
15
+ path = ARGV.shift
16
+ if path && path.length > 0
17
+ Neo4j::Config[:storage_path] = path
18
+ else
19
+ puts "Invalid database location: #{path}"
20
+ end
21
+ elsif field =~ /x/
22
+ $exists = true
23
+ elsif field =~ /X/
24
+ $exists = ARGV.shift
25
+ elsif field =~ /E/
26
+ $export = ARGV.shift
27
+ elsif field =~ /M/
28
+ $limit = Math.max(ARGV.shift.to_i, 10)
29
+ elsif field =~ /F/
30
+ $format = ARGV.shift
31
+ elsif field =~ /L/
32
+ $list = ARGV.shift
33
+ elsif field =~ /Z/
34
+ $zoom = ARGV.shift
35
+ elsif field =~ /W/
36
+ $width = ARGV.shift
37
+ elsif field =~ /H/
38
+ $height = ARGV.shift
39
+ elsif field =~ /l/
40
+ $list = 'layers'
41
+ elsif field =~ /r/
42
+ $delete = true
43
+ elsif field =~ /h/
44
+ $help = true
45
+ else
46
+ puts "Unrecognized argument: -#{field}"
47
+ end
18
48
  end
19
- elsif arg =~ /\-E/
20
- $export = ARGV.shift
21
- elsif arg =~ /\-M/
22
- $limit = Math.max(ARGV.shift.to_i, 10)
23
- elsif arg =~ /\-F/
24
- $format = ARGV.shift
25
- elsif arg =~ /\-L/
26
- $list = ARGV.shift
27
- elsif arg =~ /\-l/
28
- $list = 'layers'
29
- elsif arg =~ /\-h/
30
- $help = true
31
49
  else
32
50
  @args << arg
33
51
  end
@@ -0,0 +1,40 @@
1
+ java_import org.neo4j.gis.spatial.Constants
2
+
3
+ module Neo4j
4
+ module Spatial
5
+ class Geometry
6
+ attr_reader :gtype, :geometry
7
+ def initialize(options={})
8
+ @gtype = (options.delete(:gtype) || options.delete('gtype') || Constants.GTYPE_GEOMETRY).to_i
9
+ @geometry = (options.delete(:geometry) || options.delete('geometry') || options.delete(:default) || 'geometry').to_s.downcase
10
+ if @gtype != Geometry.string_to_id(@geometry)
11
+ if @gtype == 0
12
+ @gtype = Geometry.string_to_id(geometry)
13
+ #puts "Corrected gtype to #{gtype} for geometry #{geometry}"
14
+ elsif @geometry == 'geometry'
15
+ @geometry = Geometry.id_to_string(@gtype)
16
+ #puts "Corrected geometry to #{geometry} for gtype #{gtype}"
17
+ end
18
+ end
19
+ puts "Initialized Geometry with gtype=#{gtype}, geometry=#{geometry}"
20
+ end
21
+ def to_s
22
+ geometry
23
+ end
24
+ # Forward map from string name to integer id
25
+ def self.name_map
26
+ @name_map ||= Hash[Constants.constants.grep(/GTYPE_/).map{|v| [v.downcase.gsub(/gtype_/,''),Constants.const_get(v)]}]
27
+ end
28
+ # Reverse map from integer id to string name
29
+ def self.id_map
30
+ @id_map ||= name_map.to_a.inject({}){|a,v| a[v[1]]=v[0];a}
31
+ end
32
+ def self.string_to_id(name)
33
+ name_map[name].to_i
34
+ end
35
+ def self.id_to_string(gtype)
36
+ id_map[gtype] || 'geometry'
37
+ end
38
+ end
39
+ end
40
+ end
@@ -11,9 +11,9 @@ module Neo4j
11
11
  database(options)
12
12
  @exporter = org.neo4j.gis.spatial.geotools.data.StyledImageExporter.new(@db.graph)
13
13
  @exporter.setExportDir(options[:dir])
14
- @exporter.setZoom(options[:zoom])
15
- @exporter.setOffset((options[:offset_x] || options[:offset]).to_f, (options[:offset_y] || options[:offset]).to_f)
16
- @exporter.setSize(options[:width], options[:height])
14
+ @exporter.setZoom(options[:zoom].to_f)
15
+ @exporter.setOffset((options[:offset_x].to_f || options[:offset]).to_f, (options[:offset_y].to_f || options[:offset]).to_f)
16
+ @exporter.setSize(options[:width].to_i, options[:height].to_i)
17
17
  end
18
18
  def default(options)
19
19
  options[:dir] ||= "target/export"
@@ -0,0 +1,250 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+ <parent>
5
+ <groupId>org.neo4j</groupId>
6
+ <artifactId>parent-central</artifactId>
7
+ <version>8</version>
8
+ </parent>
9
+
10
+ <groupId>org.neo4j</groupId>
11
+ <artifactId>neo4j</artifactId>
12
+ <version>1.2</version>
13
+ <name>Neo4j</name>
14
+ <packaging>jar</packaging>
15
+ <url>http://components.neo4j.org/${project.artifactId}/${project.version}</url>
16
+ <description>A meta package containing the most used Neo4j libraries. Intended use: as a Maven dependency.</description>
17
+
18
+ <properties>
19
+ <short-name>neo4j</short-name>
20
+ </properties>
21
+
22
+ <dependencies>
23
+ <dependency>
24
+ <groupId>org.neo4j</groupId>
25
+ <artifactId>neo4j-kernel</artifactId>
26
+ <version>1.2-1.2</version>
27
+ </dependency>
28
+ <dependency>
29
+ <groupId>org.neo4j</groupId>
30
+ <artifactId>neo4j-index</artifactId>
31
+ <version>1.2-1.2</version>
32
+ </dependency>
33
+ <dependency>
34
+ <groupId>org.neo4j</groupId>
35
+ <artifactId>neo4j-lucene-index</artifactId>
36
+ <version>0.2-1.2</version>
37
+ </dependency>
38
+ <dependency>
39
+ <groupId>org.neo4j</groupId>
40
+ <artifactId>neo4j-shell</artifactId>
41
+ <version>1.2-1.2</version>
42
+ </dependency>
43
+ <dependency>
44
+ <groupId>org.neo4j</groupId>
45
+ <artifactId>neo4j-remote-graphdb</artifactId>
46
+ <version>0.8-1.2</version>
47
+ </dependency>
48
+ <dependency>
49
+ <groupId>org.neo4j</groupId>
50
+ <artifactId>neo4j-graph-algo</artifactId>
51
+ <version>0.7-1.2</version>
52
+ </dependency>
53
+ <dependency>
54
+ <groupId>org.neo4j</groupId>
55
+ <artifactId>neo4j-online-backup</artifactId>
56
+ <version>0.7-1.2</version>
57
+ </dependency>
58
+ <dependency>
59
+ <groupId>org.neo4j</groupId>
60
+ <artifactId>neo4j-udc</artifactId>
61
+ <version>0.1-1.2</version>
62
+ </dependency>
63
+ <dependency>
64
+ <groupId>org.neo4j</groupId>
65
+ <artifactId>neo4j-management</artifactId>
66
+ <version>1.2-1.2</version>
67
+ </dependency>
68
+ <dependency>
69
+ <groupId>org.neo4j</groupId>
70
+ <artifactId>neo4j-ha</artifactId>
71
+ <version>0.5-1.2</version>
72
+ </dependency>
73
+ </dependencies>
74
+
75
+ <scm>
76
+ <connection>scm:svn:https://svn.neo4j.org/components/neo4j/tags/1.2</connection>
77
+ <developerConnection>scm:svn:https://svn.neo4j.org/components/neo4j/tags/1.2</developerConnection>
78
+ <url>scm:svn:https://svn.neo4j.org/components/neo4j/tags/1.2</url>
79
+ </scm>
80
+
81
+ <licenses>
82
+ <license>
83
+ <name>Apache License Version 2.0</name>
84
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
85
+ <comments>
86
+ Note that this license is for the project itself,
87
+ and not for its dependencies. See the included NOTICE.txt
88
+ file for further details.
89
+ </comments>
90
+ </license>
91
+ </licenses>
92
+
93
+ <issueManagement>
94
+ <system>Trac</system>
95
+ <url>https://trac.neo4j.org/query?status=assigned&amp;status=new&amp;status=reopened&amp;component=neo4j</url>
96
+ </issueManagement>
97
+
98
+ <developers>
99
+ <developer>
100
+ <id>andersn</id>
101
+ <name>Anders Nawroth</name>
102
+ <email>anders [at] neotechnology.com</email>
103
+ <timezone>+1</timezone>
104
+ <roles>
105
+ <role>Developer</role>
106
+ </roles>
107
+ </developer>
108
+ </developers>
109
+
110
+ <build>
111
+ <plugins>
112
+ <plugin>
113
+ <artifactId>maven-resources-plugin</artifactId>
114
+ <executions>
115
+ <execution>
116
+ <id>copy-resources</id>
117
+ <phase>validate</phase>
118
+ <goals>
119
+ <goal>copy-resources</goal>
120
+ </goals>
121
+ <configuration>
122
+ <outputDirectory>${project.build.directory}/extra-resources</outputDirectory>
123
+ <resources>
124
+ <resource>
125
+ <directory>src/main/resources/</directory>
126
+ <filtering>true</filtering>
127
+ </resource>
128
+ </resources>
129
+ </configuration>
130
+ </execution>
131
+ </executions>
132
+ </plugin>
133
+ <plugin>
134
+ <artifactId>maven-dependency-plugin</artifactId>
135
+ <executions>
136
+ <execution>
137
+ <id>get-sources</id>
138
+ <goals>
139
+ <goal>unpack-dependencies</goal>
140
+ </goals>
141
+ <configuration>
142
+ <classifier>sources</classifier>
143
+ <outputDirectory>${project.build.directory}/sources</outputDirectory>
144
+ <includeGroupIds>org.neo4j</includeGroupIds>
145
+ </configuration>
146
+ </execution>
147
+ <execution>
148
+ <id>get-javadoc-sources</id>
149
+ <goals>
150
+ <goal>unpack-dependencies</goal>
151
+ </goals>
152
+ <configuration>
153
+ <classifier>sources</classifier>
154
+ <outputDirectory>${project.build.directory}/javadoc-sources</outputDirectory>
155
+ <includeGroupIds>org.neo4j</includeGroupIds>
156
+ </configuration>
157
+ </execution>
158
+ <!--
159
+ <execution>
160
+ <id>get-test-sources</id>
161
+ <goals>
162
+ <goal>unpack-dependencies</goal>
163
+ </goals>
164
+ <configuration>
165
+ <classifier>test-sources</classifier>
166
+ <outputDirectory>${project.build.directory}/test-sources</outputDirectory>
167
+ <includeGroupIds>org.neo4j</includeGroupIds>
168
+ </configuration>
169
+ </execution>
170
+ -->
171
+ </executions>
172
+ </plugin>
173
+ <plugin>
174
+ <artifactId>maven-javadoc-plugin</artifactId>
175
+ <executions>
176
+ <execution>
177
+ <id>create-javadocs</id>
178
+ <phase>process-resources</phase>
179
+ <goals>
180
+ <goal>javadoc</goal>
181
+ </goals>
182
+ <configuration>
183
+ <doctitle>Neo4j ${project.version} API</doctitle>
184
+ <outputDirectory>${project.build.directory}/site/apidocs</outputDirectory>
185
+ <sourcepath>${project.build.directory}/javadoc-sources</sourcepath>
186
+ <excludePackageNames>*.impl.*:org.neo4j.shell:org.neo4j.remote.inspect:org.neo4j.onlinebackup.ha:org.neo4j.onlinebackup.net:org.neo4j.ext.udc:org.neo4j.kernel.ha:org.neo4j.kernel.ha.*
187
+ </excludePackageNames>
188
+ </configuration>
189
+ </execution>
190
+ </executions>
191
+ </plugin>
192
+ <plugin>
193
+ <artifactId>maven-jxr-plugin</artifactId>
194
+ <configuration>
195
+ </configuration>
196
+ <executions>
197
+ <execution>
198
+ <id>create-source-html</id>
199
+ <configuration>
200
+ <sourcePath>${project.build.directory}/sources</sourcePath>
201
+ </configuration>
202
+ <phase>process-resources</phase>
203
+ <goals>
204
+ <goal>jxr</goal>
205
+ </goals>
206
+ </execution>
207
+ </executions>
208
+ </plugin>
209
+ <plugin>
210
+ <artifactId>maven-assembly-plugin</artifactId>
211
+ <executions>
212
+ <execution>
213
+ <id>package-javadocs</id>
214
+ <phase>package</phase>
215
+ <goals>
216
+ <goal>single</goal>
217
+ </goals>
218
+ <configuration>
219
+ <attach>true</attach>
220
+ <descriptors>
221
+ <descriptor>src/main/assembly/assembly.xml</descriptor>
222
+ </descriptors>
223
+ </configuration>
224
+ </execution>
225
+ </executions>
226
+ </plugin>
227
+ </plugins>
228
+ </build>
229
+
230
+ <reporting>
231
+ <plugins>
232
+ <plugin>
233
+ <groupId>org.codehaus.mojo</groupId>
234
+ <artifactId>clirr-maven-plugin</artifactId>
235
+ <reportSets>
236
+ <reportSet />
237
+ </reportSets>
238
+ </plugin>
239
+ </plugins>
240
+ </reporting>
241
+
242
+ <distributionManagement>
243
+ <site>
244
+ <id>neo4j-site</id>
245
+ <url>scpexe://components.neo4j.org/home/neo/components/${project.artifactId}/${project.version}</url>
246
+ </site>
247
+ </distributionManagement>
248
+
249
+ </project>
250
+
@@ -38,6 +38,15 @@ module Neo4j
38
38
  def to_s
39
39
  @layer.name
40
40
  end
41
+ def describe
42
+ %Q{#{@layer.name} (#{type_name}:#{geometry}#{parent ? " from #{parent.name}" : ''})}
43
+ end
44
+ def geometry
45
+ Geometry.id_to_string(@layer.geometry_type)
46
+ end
47
+ def parent
48
+ @parent ||= @layer.respond_to?('parent') ? @layer.parent : nil
49
+ end
41
50
  def type_name
42
51
  @layer.class.to_s.downcase.gsub(/.*[\.\:](\w+)layer.*/){|m| $1}
43
52
  end
@@ -1,5 +1,6 @@
1
1
  require 'neo4j/spatial/listener'
2
2
  require 'neo4j/spatial/database'
3
+ require 'neo4j/spatial/geometry'
3
4
 
4
5
  java_import org.neo4j.gis.spatial.Constants
5
6
  java_import org.neo4j.gis.spatial.SpatialDatabaseService
@@ -71,16 +72,31 @@ module Neo4j
71
72
  :encoder => OSMGeometryEncoder
72
73
  }))
73
74
  end
75
+ def remove_dynamic_layer(options={})
76
+ add_dynamic_layer(options.merge(:delete => true))
77
+ end
74
78
  def add_dynamic_layer(options={})
75
- gtype = (options.delete(:gtype) || Constants.GTYPE_LINESTRING).to_i
79
+ delete = options.delete(:delete)
80
+ options[:default] ||= :linestring
81
+ geometry = Geometry.new(options)
82
+ options.delete :default
76
83
  name ||= options.delete(:layer_name) ||
77
- !options.empty? && options.to_a.flatten.compact.join('-') ||
78
- SpatialDatabaseService.convertGeometryTypeToName(gtype)
84
+ !options.empty? && options.to_a.flatten.compact.join('-').gsub(/\-+$/,'') ||
85
+ geometry.to_s
79
86
  if list.grep(name).length > 0
80
- puts "We already have a dynamic layer called '#{name}'"
87
+ if delete
88
+ puts "Deleting dynamic layer '#{name}'[Geometry:#{geometry}]: #{options.inspect}"
89
+ layer.remove_dynamic_layer(name.to_s)
90
+ else
91
+ puts "We already have a dynamic layer called '#{name}'"
92
+ end
81
93
  else
82
- puts "Creating new dynamic layer '#{name}'[GType:#{TYPES[gtype]}]: #{options.inspect}"
83
- layer.add_dynamic_layer_on_way_tags(name.to_s, gtype, java.util.HashMap.new(options))
94
+ if delete
95
+ puts "No such dynamic layer found for OSM-layer '#{self}': #{name}"
96
+ else
97
+ puts "Creating new dynamic layer '#{name}'[Geometry:#{geometry}]: #{options.inspect}"
98
+ layer.add_dynamic_layer_on_way_tags(name.to_s, geometry.gtype, java.util.HashMap.new(options))
99
+ end
84
100
  end
85
101
  end
86
102
  # List dynamic layers associated with this layer
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module Spatial
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -21,7 +21,7 @@ access Neo4j-Spatial features from the convenience of the Ruby scripting languag
21
21
  EOF
22
22
 
23
23
  s.require_path = 'lib'
24
- s.files = Dir.glob("{bin,lib,examples}/**/*").reject{|x| x=~/tmp/} + %w(README.rdoc CHANGELOG CONTRIBUTORS Gemfile neo4j-spatial.gemspec)
24
+ s.files = Dir.glob("{bin,lib,examples}/**/*").reject{|x| x=~/(tmp|target|croatia|test-data)/} + %w(README.rdoc CHANGELOG CONTRIBUTORS Gemfile neo4j-spatial.gemspec)
25
25
  s.has_rdoc = true
26
26
  s.extra_rdoc_files = %w( README.rdoc )
27
27
  s.rdoc_options = ["--quiet", "--title", "Neo4j-Spatial.rb", "--opname", "index.html", "--line-numbers", "--main", "README.rdoc", "--inline-source"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-spatial
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: java
12
12
  authors:
13
13
  - Craig Taverner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-13 00:00:00 +01:00
18
+ date: 2011-01-23 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -70,13 +70,40 @@ files:
70
70
  - lib/neo4j/spatial/osm.rb
71
71
  - lib/neo4j/spatial/database.rb
72
72
  - lib/neo4j/spatial/layer.rb
73
+ - lib/neo4j/spatial/jars/jackson-core-asl-1.6.1.jar
74
+ - lib/neo4j/spatial/jars/slf4j-api-1.5.10.jar
75
+ - lib/neo4j/spatial/jars/neo4j-index-1.2-1.2.jar
73
76
  - lib/neo4j/spatial/jars/gt-main/xercesImpl-2.4.0.jar
74
77
  - lib/neo4j/spatial/jars/gt-main/gt-api-2.7-M3.jar
75
78
  - lib/neo4j/spatial/jars/gt-main/jdom-1.0.jar
76
79
  - lib/neo4j/spatial/jars/gt-main/jts-1.11.jar
77
80
  - lib/neo4j/spatial/jars/gt-main/gt-main-2.7-M3.jar
81
+ - lib/neo4j/spatial/jars/org.apache.felix.framework-3.0.2.jar
82
+ - lib/neo4j/spatial/jars/org.apache.servicemix.bundles.lucene-3.0.1_2.jar
83
+ - lib/neo4j/spatial/jars/neo4j-online-backup-0.7-1.2.jar
84
+ - lib/neo4j/spatial/jars/junit-4.8.1.jar
78
85
  - lib/neo4j/spatial/jars/json-simple-1.1.jar
86
+ - lib/neo4j/spatial/jars/commons-logging-1.1.1.jar
87
+ - lib/neo4j/spatial/jars/commons-beanutils-core-1.8.0.jar
88
+ - lib/neo4j/spatial/jars/org.osgi.compendium-4.1.0.jar
89
+ - lib/neo4j/spatial/jars/collections-generic-4.01.jar
90
+ - lib/neo4j/spatial/jars/jconsole.jar
91
+ - lib/neo4j/spatial/jars/commons-configuration-1.6.jar
79
92
  - lib/neo4j/spatial/jars/log4j-1.2.14.jar
93
+ - lib/neo4j/spatial/jars/jung-algorithms-2.0.jar
94
+ - lib/neo4j/spatial/jars/rrd4j-2.0.6.jar
95
+ - lib/neo4j/spatial/jars/jackson-jaxrs-1.6.1.jar
96
+ - lib/neo4j/spatial/jars/neo4j-server-0.5-1.2.jar
97
+ - lib/neo4j/spatial/jars/commons-digester-1.8.jar
98
+ - lib/neo4j/spatial/jars/neo4j-lucene-index-0.2-1.2.jar
99
+ - lib/neo4j/spatial/jars/org.osgi.core-4.1.0.jar
100
+ - lib/neo4j/spatial/jars/gremlin-0.6.jar
101
+ - lib/neo4j/spatial/jars/jersey-core-1.4.jar
102
+ - lib/neo4j/spatial/jars/mimepull-1.4.jar
103
+ - lib/neo4j/spatial/jars/commons-lang-2.4.jar
104
+ - lib/neo4j/spatial/jars/commons-beanutils-1.7.0.jar
105
+ - lib/neo4j/spatial/jars/jersey-multipart-1.3.jar
106
+ - lib/neo4j/spatial/jars/org.apache.felix.fileinstall-3.0.2.jar
80
107
  - lib/neo4j/spatial/jars/gt-render/jai_codec-1.1.3.jar
81
108
  - lib/neo4j/spatial/jars/gt-render/imageio-ext-tiff-1.0.7.jar
82
109
  - lib/neo4j/spatial/jars/gt-render/gt-render-2.7-M3.jar
@@ -85,7 +112,27 @@ files:
85
112
  - lib/neo4j/spatial/jars/gt-render/imageio-ext-utilities-1.0.7.jar
86
113
  - lib/neo4j/spatial/jars/gt-render/jai_core-1.1.3.jar
87
114
  - lib/neo4j/spatial/jars/gt-render/jai_imageio-1.1.jar
115
+ - lib/neo4j/spatial/jars/pipes-0.2.jar
116
+ - lib/neo4j/spatial/jars/geronimo-jta_1.1_spec-1.1.1.jar
117
+ - lib/neo4j/spatial/jars/colt-1.2.0.jar
118
+ - lib/neo4j/spatial/jars/org.apache.felix.main-3.0.2.jar
119
+ - lib/neo4j/spatial/jars/jetty-6.1.25.jar
120
+ - lib/neo4j/spatial/jars/zookeeper-3.3.2.jar
121
+ - lib/neo4j/spatial/jars/stringtemplate-3.2.jar
122
+ - lib/neo4j/spatial/jars/neo4j-shell-1.2-1.2.jar
123
+ - lib/neo4j/spatial/jars/antlr-3.2.jar
124
+ - lib/neo4j/spatial/jars/neo4j-remote-graphdb-0.8-1.2.jar
125
+ - lib/neo4j/spatial/jars/blueprints-0.3.jar
126
+ - lib/neo4j/spatial/jars/jersey-server-1.4.jar
127
+ - lib/neo4j/spatial/jars/neo4j-kernel-1.2-1.2.jar
128
+ - lib/neo4j/spatial/jars/neo4j-udc-0.1-1.2.jar
129
+ - lib/neo4j/spatial/jars/jackson-mapper-asl-1.6.1.jar
130
+ - lib/neo4j/spatial/jars/neo4j-ha-0.5-1.2.jar
88
131
  - lib/neo4j/spatial/jars/neo4j-spatial-0.3-SNAPSHOT.jar
132
+ - lib/neo4j/spatial/jars/antlr-2.7.7.jar
133
+ - lib/neo4j/spatial/jars/antlr-runtime-3.2.jar
134
+ - lib/neo4j/spatial/jars/org.apache.servicemix.bundles.jline-0.9.94_1.jar
135
+ - lib/neo4j/spatial/jars/netty-3.2.1.Final.jar
89
136
  - lib/neo4j/spatial/jars/gt-shapefile/jsr-275-1.0-beta-2.jar
90
137
  - lib/neo4j/spatial/jars/gt-shapefile/geoapi-2.3-M1.jar
91
138
  - lib/neo4j/spatial/jars/gt-shapefile/gt-data-2.7-M3.jar
@@ -95,11 +142,24 @@ files:
95
142
  - lib/neo4j/spatial/jars/gt-shapefile/gt-metadata-2.7-M3.jar
96
143
  - lib/neo4j/spatial/jars/gt-shapefile/gt-referencing-2.7-M3.jar
97
144
  - lib/neo4j/spatial/jars/gt-shapefile/geoapi-pending-2.3-M1.jar
145
+ - lib/neo4j/spatial/jars/neo4j-management-1.2-1.2.jar
146
+ - lib/neo4j/spatial/jars/jetty-util-6.1.25.jar
147
+ - lib/neo4j/spatial/jars/neo4j-graph-algo-0.7-1.2.jar
148
+ - lib/neo4j/spatial/jars/slf4j-log4j12-1.5.10.jar
149
+ - lib/neo4j/spatial/jars/commons-io-1.4.jar
150
+ - lib/neo4j/spatial/jars/concurrent-1.3.4.jar
151
+ - lib/neo4j/spatial/jars/servlet-api-2.5-20081211.jar
152
+ - lib/neo4j/spatial/jars/commons-collections-3.2.1.jar
153
+ - lib/neo4j/spatial/jars/jung-api-2.0.jar
154
+ - lib/neo4j/spatial/jars/asm-3.1.jar
155
+ - lib/neo4j/spatial/jars/protobuf-java-2.3.0.jar
156
+ - lib/neo4j/spatial/jars/neo4j-1.2.pom
98
157
  - lib/neo4j/spatial/cmd.rb
99
158
  - lib/neo4j/spatial/shapefile.rb
100
159
  - lib/neo4j/spatial/image.rb
101
160
  - lib/neo4j/spatial/listener.rb
102
161
  - lib/neo4j/spatial/version.rb
162
+ - lib/neo4j/spatial/geometry.rb
103
163
  - lib/neo4j/spatial.rb
104
164
  - examples/osm_import.rb
105
165
  - examples/test.rb