diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index f149bd811..a551a0b16 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -72,7 +72,7 @@ jobs:
- name: Upload all jars to Release
uses: AButler/upload-release-assets@v3.0
with:
- files: "target/*.jar"
+ files: "**/target/*.jar"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-id: ${{ steps.create_release.outputs.id }}
@@ -85,4 +85,4 @@ jobs:
with:
token: ${{ secrets.BUILD_ACCESS_TOKEN }}
repository: neo4j-documentation/docs-refresh
- event-type: labs
\ No newline at end of file
+ event-type: labs
diff --git a/README.md b/README.md
index 815544f49..3845d408e 100755
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ This means that Neo4j Spatial 5.19.0 is build against Neo4j 5.19, and so on.
## Installation
-1. Copy the desired neo4j-spatial-x.x.x-server-plugin.jar from the [release page](https://github.com/neo4j-contrib/spatial/releases) to your neo4j plugin directory.
+1. Copy the desired neo4j-spatial-server-plugin-x.x.x-with-dependencies.jar from the [release page](https://github.com/neo4j-contrib/spatial/releases) to your neo4j plugin directory.
2. set up your database with the following configuration in your `neo4j.conf` file:
```
@@ -188,11 +188,11 @@ RETURN node.name AS name
~~~
For further Java examples, refer to the test code in the
-[LayersTest](src/test/java/org/neo4j/gis/spatial/LayersTest.java) and
-the [TestSpatial](src/test/java/org/neo4j/gis/spatial/TestSpatial.java) classes.
+[LayersTest](server-plugin/src/test/java/org/neo4j/gis/spatial/LayersTest.java) and
+the [TestSpatial](server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatial.java) classes.
For further Procedures examples, refer to the code in
-the [SpatialProceduresTest](src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java)
+the [SpatialProceduresTest](server-plugin/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java)
class.
## Neo4j Spatial Geoserver Plugin ##
@@ -305,7 +305,7 @@ The Java API (the original API for Neo4j Spatial) still remains, however, the mo
and therefor we recommend that if you need to access Neo4j server remotely, and want deeper access to Spatial functions,
consider writing your own Procedures. The Neo4j 3.0 documentation provides some good information on how to do this,
and you can also refer to
-the [Neo4j Spatial procedures source code](src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java)
+the [Neo4j Spatial procedures source code](server-plugin/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java)
for examples.
## Building Neo4j spatial ##
diff --git a/docs/docs/modules/ROOT/examples/GeoPipesDocTest.java b/docs/docs/modules/ROOT/examples/GeoPipesDocTest.java
index 94fcd9b2f..9aa61b6dd 120000
--- a/docs/docs/modules/ROOT/examples/GeoPipesDocTest.java
+++ b/docs/docs/modules/ROOT/examples/GeoPipesDocTest.java
@@ -1 +1 @@
-../../../../../src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java
\ No newline at end of file
+../../../../../server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java
\ No newline at end of file
diff --git a/docs/docs/modules/ROOT/examples/TestsForDocs.java b/docs/docs/modules/ROOT/examples/TestsForDocs.java
index da3d7ce5a..a49dfcc63 120000
--- a/docs/docs/modules/ROOT/examples/TestsForDocs.java
+++ b/docs/docs/modules/ROOT/examples/TestsForDocs.java
@@ -1 +1 @@
-../../../../../src/test/java/org/neo4j/gis/spatial/TestsForDocs.java
\ No newline at end of file
+../../../../../server-plugin/src/test/java/org/neo4j/gis/spatial/TestsForDocs.java
\ No newline at end of file
diff --git a/docs/docs/modules/ROOT/pages/overview/introduction.adoc b/docs/docs/modules/ROOT/pages/overview/introduction.adoc
index 9c8d0b5fa..b11cf07e3 100644
--- a/docs/docs/modules/ROOT/pages/overview/introduction.adoc
+++ b/docs/docs/modules/ROOT/pages/overview/introduction.adoc
@@ -19,7 +19,7 @@ The key features include:
== Get Started
-The easiest way to get started with neo4j-spatial is to grab the `server-plugin-*.jar` from https://github.com/neo4j-contrib/spatial/releases[the latest release], copy it to your `$NEO4J_HOME/plugins` and restart your Neo4j server.
+The easiest way to get started with neo4j-spatial is to grab the `neo4j-spatial-server-plugin-x.x.x-with-dependencies.jar` from https://github.com/neo4j-contrib/spatial/releases[the latest release], copy it to your `$NEO4J_HOME/plugins` and restart your Neo4j server.
From there you can use all the xref:api/index.adoc[spatial procedures and functions] in your Cypher queries to add Nodes to the spatial index and perform a number of spatial point, distance and intersection queries.
diff --git a/pom.xml b/pom.xml
index a8521cf5b..71758fbfa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,9 +19,14 @@
5.26.1-SNAPSHOT
Neo4j - Spatial Components
Spatial utilities and components for Neo4j
- https://components.neo4j.org/${project.artifactId}/${project.version}
+ https://neo4j.com/labs/neo4j-spatial/5/
2010
- jar
+ pom
+
+
+ server-plugin
+
+
https://github.com/neo4j/spatial/
scm:git:git://github.com/neo4j/spatial.git
@@ -30,51 +35,6 @@
-
- maven-dependency-plugin
-
-
- copy-dependencies
- process-resources
-
- copy-dependencies
-
-
- provided
-
-
-
- get-test-data
-
- unpack-dependencies
-
-
- ${project.build.directory}
- org.neo4j.spatial
-
-
-
-
-
- maven-assembly-plugin
- 3.7.1
-
-
- src/main/assembly/server-plugin.xml
-
-
-
-
- make-assembly
-
- package
-
-
- single
-
-
-
-
maven-surefire-plugin
${maven-surefire-plugin.version}
@@ -144,107 +104,6 @@
-
-
- org.neo4j
- neo4j
- ${neo4j.version}
- provided
-
-
- com.google.code.gson
- gson
- 2.13.1
- test
-
-
- org.neo4j
- neo4j-graphviz
- 3.1.1
- test
-
-
- org.neo4j
- neo4j-kernel
-
-
-
-
-
-
- org.junit.jupiter
- junit-jupiter-engine
- 5.11.3
- test
-
-
- org.neo4j.spatial
- osm-test-data
- ${spatial.test.osm.version}
- test
-
-
- org.neo4j.spatial
- shp-test-data
- ${spatial.test.shp.version}
- test
-
-
- org.geotools
- gt-main
- ${geotools.version}
-
-
- org.geotools
- gt-shapefile
- ${geotools.version}
-
-
- org.geotools
- gt-process
- ${geotools.version}
-
-
- org.geotools
- gt-geojson
- ${geotools.version}
-
-
- org.geotools.xsd
- gt-xsd-kml
- ${geotools.version}
- provided
-
-
- picocontainer
- picocontainer
-
-
-
-
- org.geotools
- gt-render
- ${geotools.version}
-
-
- it.geosolutions.imageio-ext
- imageio-ext-tiff
-
-
-
-
- org.neo4j.community
- it-test-support
- ${neo4j.version}
- test
-
-
- org.neo4j
- neo4j-kernel-test-utils
- ${neo4j.version}
- test
-
-
@@ -276,10 +135,11 @@
com.google.errorprone
error_prone_annotations
- 2.28.0
+ 2.27.0
+
osgeo
diff --git a/map.osm b/server-plugin/map.osm
similarity index 100%
rename from map.osm
rename to server-plugin/map.osm
diff --git a/map2.osm b/server-plugin/map2.osm
similarity index 100%
rename from map2.osm
rename to server-plugin/map2.osm
diff --git a/one-street.osm b/server-plugin/one-street.osm
similarity index 100%
rename from one-street.osm
rename to server-plugin/one-street.osm
diff --git a/server-plugin/pom.xml b/server-plugin/pom.xml
new file mode 100644
index 000000000..06e51a835
--- /dev/null
+++ b/server-plugin/pom.xml
@@ -0,0 +1,187 @@
+
+
+
+
+ 4.0.0
+
+ org.neo4j
+ neo4j-spatial
+ 5.26.1-SNAPSHOT
+
+
+ neo4j-spatial-server-plugin
+
+
+
+
+ maven-dependency-plugin
+
+
+ copy-dependencies
+ process-resources
+
+ copy-dependencies
+
+
+ provided
+
+
+
+ get-test-data
+
+ unpack-dependencies
+
+
+ ${project.build.directory}
+ org.neo4j.spatial
+
+
+
+
+
+ maven-assembly-plugin
+ 3.7.1
+
+
+ src/main/assembly/server-plugin.xml
+
+
+
+
+ make-assembly
+
+ package
+
+
+ single
+
+
+
+
+
+
+
+
+
+ org.neo4j
+ neo4j
+ ${neo4j.version}
+ provided
+
+
+ com.google.code.gson
+ gson
+ 2.13.1
+ test
+
+
+ org.neo4j
+ neo4j-graphviz
+ 3.1.1
+ test
+
+
+ org.neo4j
+ neo4j-kernel
+
+
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.11.3
+ test
+
+
+ org.neo4j.spatial
+ osm-test-data
+ ${spatial.test.osm.version}
+ test
+
+
+ org.neo4j.spatial
+ shp-test-data
+ ${spatial.test.shp.version}
+ test
+
+
+ org.geotools
+ gt-main
+ ${geotools.version}
+
+
+ org.geotools
+ gt-shapefile
+ ${geotools.version}
+
+
+ org.geotools
+ gt-process
+ ${geotools.version}
+
+
+ org.geotools
+ gt-geojson
+ ${geotools.version}
+
+
+ org.geotools.xsd
+ gt-xsd-kml
+ ${geotools.version}
+ provided
+
+
+ picocontainer
+ picocontainer
+
+
+
+
+ org.geotools
+ gt-render
+ ${geotools.version}
+
+
+ it.geosolutions.imageio-ext
+ imageio-ext-tiff
+
+
+
+
+ org.neo4j.community
+ it-test-support
+ ${neo4j.version}
+ test
+
+
+ org.neo4j
+ neo4j-kernel-test-utils
+ ${neo4j.version}
+ test
+
+
+
+
+
diff --git a/sample.osm b/server-plugin/sample.osm
similarity index 100%
rename from sample.osm
rename to server-plugin/sample.osm
diff --git a/shp/highway.dbf b/server-plugin/shp/highway.dbf
similarity index 100%
rename from shp/highway.dbf
rename to server-plugin/shp/highway.dbf
diff --git a/shp/highway.fix b/server-plugin/shp/highway.fix
similarity index 100%
rename from shp/highway.fix
rename to server-plugin/shp/highway.fix
diff --git a/shp/highway.prj b/server-plugin/shp/highway.prj
similarity index 100%
rename from shp/highway.prj
rename to server-plugin/shp/highway.prj
diff --git a/shp/highway.qix b/server-plugin/shp/highway.qix
similarity index 100%
rename from shp/highway.qix
rename to server-plugin/shp/highway.qix
diff --git a/shp/highway.shp b/server-plugin/shp/highway.shp
similarity index 100%
rename from shp/highway.shp
rename to server-plugin/shp/highway.shp
diff --git a/shp/highway.shx b/server-plugin/shp/highway.shx
similarity index 100%
rename from shp/highway.shx
rename to server-plugin/shp/highway.shx
diff --git a/sld/background.sld b/server-plugin/sld/background.sld
similarity index 100%
rename from sld/background.sld
rename to server-plugin/sld/background.sld
diff --git a/sld/rank-days.sld b/server-plugin/sld/rank-days.sld
similarity index 100%
rename from sld/rank-days.sld
rename to server-plugin/sld/rank-days.sld
diff --git a/sld/rank.sld b/server-plugin/sld/rank.sld
similarity index 100%
rename from sld/rank.sld
rename to server-plugin/sld/rank.sld
diff --git a/src/main/assembly/geoserver-plugin.xml b/server-plugin/src/main/assembly/geoserver-plugin.xml
similarity index 100%
rename from src/main/assembly/geoserver-plugin.xml
rename to server-plugin/src/main/assembly/geoserver-plugin.xml
diff --git a/src/main/assembly/server-plugin.xml b/server-plugin/src/main/assembly/server-plugin.xml
similarity index 98%
rename from src/main/assembly/server-plugin.xml
rename to server-plugin/src/main/assembly/server-plugin.xml
index 0f981344d..8683519bb 100644
--- a/src/main/assembly/server-plugin.xml
+++ b/server-plugin/src/main/assembly/server-plugin.xml
@@ -20,7 +20,7 @@
- server-plugin
+ with-dependencies
jar
diff --git a/src/main/java/org/geotools/data/neo4j/DefaultResourceInfo.java b/server-plugin/src/main/java/org/geotools/data/neo4j/DefaultResourceInfo.java
similarity index 100%
rename from src/main/java/org/geotools/data/neo4j/DefaultResourceInfo.java
rename to server-plugin/src/main/java/org/geotools/data/neo4j/DefaultResourceInfo.java
diff --git a/src/main/java/org/geotools/data/neo4j/Neo4jFeatureBuilder.java b/server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jFeatureBuilder.java
similarity index 100%
rename from src/main/java/org/geotools/data/neo4j/Neo4jFeatureBuilder.java
rename to server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jFeatureBuilder.java
diff --git a/src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStore.java b/server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStore.java
similarity index 100%
rename from src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStore.java
rename to server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStore.java
diff --git a/src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStoreFactory.java b/server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStoreFactory.java
similarity index 100%
rename from src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStoreFactory.java
rename to server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStoreFactory.java
diff --git a/src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureSource.java b/server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureSource.java
similarity index 100%
rename from src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureSource.java
rename to server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureSource.java
diff --git a/src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureStore.java b/server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureStore.java
similarity index 100%
rename from src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureStore.java
rename to server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureStore.java
diff --git a/src/main/java/org/geotools/data/neo4j/StyledImageExporter.java b/server-plugin/src/main/java/org/geotools/data/neo4j/StyledImageExporter.java
similarity index 100%
rename from src/main/java/org/geotools/data/neo4j/StyledImageExporter.java
rename to server-plugin/src/main/java/org/geotools/data/neo4j/StyledImageExporter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/AbstractGeometryEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/AbstractGeometryEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/AbstractGeometryEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/AbstractGeometryEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/ConsoleListener.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/ConsoleListener.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/ConsoleListener.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/ConsoleListener.java
diff --git a/src/main/java/org/neo4j/gis/spatial/Constants.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/Constants.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/Constants.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/Constants.java
index 738c265aa..b0effea45 100644
--- a/src/main/java/org/neo4j/gis/spatial/Constants.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/Constants.java
@@ -1,104 +1,104 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import org.neo4j.graphdb.Label;
-
-/**
- * @author Davide Savazzi
- */
-public interface Constants {
-
- // Node properties
-
- String PROP_BBOX = "bbox";
- String PROP_LAYER = "layer";
- String PROP_LAYERNODEEXTRAPROPS = "layerprops";
- String PROP_CRS = "layercrs";
- String PROP_GEOMENCODER = "geomencoder";
- String PROP_INDEX_CLASS = "index_class";
- String PROP_GEOMENCODER_CONFIG = "geomencoder_config";
- String PROP_INDEX_CONFIG = "index_config";
- String PROP_LAYER_CLASS = "layer_class";
-
- String PROP_TYPE = "gtype";
- String PROP_QUERY = "query";
- String PROP_WKB = "wkb";
- String PROP_WKT = "wkt";
- String PROP_GEOM = "geometry";
-
- String[] RESERVED_PROPS = new String[]{
- PROP_BBOX,
- PROP_LAYER,
- PROP_LAYERNODEEXTRAPROPS,
- PROP_CRS,
- PROP_TYPE,
- PROP_WKB,
- PROP_WKT,
- PROP_GEOM
- };
-
- Label LABEL_LAYER = Label.label("SpatialLayer");
-
- // OpenGIS geometry type numbers
-
- int GTYPE_GEOMETRY = 0;
- int GTYPE_POINT = 1;
- int GTYPE_LINESTRING = 2;
- int GTYPE_POLYGON = 3;
- int GTYPE_MULTIPOINT = 4;
- int GTYPE_MULTILINESTRING = 5;
- int GTYPE_MULTIPOLYGON = 6;
-
- int SRID_COORDINATES_2D = 4326;
- int SRID_COORDINATES_3D = 4979;
-
- String INDEX_TYPE_RTREE = "rtree";
- String INDEX_TYPE_GEOHASH = "geohash";
- String INDEX_TYPE_ZORDER = "zorder";
- String INDEX_TYPE_HILBERT = "hilbert";
-
- String WGS84_CRS_NAME = "wgs84";
-
-
- String DOC_LAYER_NAME = "The name of the layer";
- String DOC_LAYER_TYPE = "The type of the new layer. Existing layer types can be queried by `spatial.layer`";
- String DOC_ENCODER_CONFIG = "The configuration of the encoder that is used by layer to en-/decode the geometry of indexed nodes";
- String DOC_INDEX_CONFIG = "The configuration of the newly created index";
- String DOC_ENCODER_NAME = "The name of the encoder to be used for the new layer";
- String DOC_INDEX_TYPE =
- "The type of the index algorithm to be used, valid values are: `" + INDEX_TYPE_RTREE + "`, `"
- + INDEX_TYPE_GEOHASH + "`, `" + INDEX_TYPE_ZORDER + "` or `" + INDEX_TYPE_HILBERT + "`";
- String DOC_CRS = "The CRS to be used, valid values are: `" + WGS84_CRS_NAME + "`";
- String DOC_COORDINATE = """
- A valid value for the coordinate is a:
-
- * JTS Coordinate
- * Neo4j Coordinate
- * Neo4j Point
- * Map with keys 'latitude' and 'longitude'
- * Map with keys 'lat' and 'lon'"
- * Node or Relationship with properties 'latitude' and 'longitude'
- * Node or Relationship with properties 'lat' and 'lon'
- """;
- String DOC_URI = "The path of the file to import the data from";
-
- String DOC_JTS_GEOMETRY = "A WKT string or a coordinate. " + DOC_COORDINATE;
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import org.neo4j.graphdb.Label;
+
+/**
+ * @author Davide Savazzi
+ */
+public interface Constants {
+
+ // Node properties
+
+ String PROP_BBOX = "bbox";
+ String PROP_LAYER = "layer";
+ String PROP_LAYERNODEEXTRAPROPS = "layerprops";
+ String PROP_CRS = "layercrs";
+ String PROP_GEOMENCODER = "geomencoder";
+ String PROP_INDEX_CLASS = "index_class";
+ String PROP_GEOMENCODER_CONFIG = "geomencoder_config";
+ String PROP_INDEX_CONFIG = "index_config";
+ String PROP_LAYER_CLASS = "layer_class";
+
+ String PROP_TYPE = "gtype";
+ String PROP_QUERY = "query";
+ String PROP_WKB = "wkb";
+ String PROP_WKT = "wkt";
+ String PROP_GEOM = "geometry";
+
+ String[] RESERVED_PROPS = new String[]{
+ PROP_BBOX,
+ PROP_LAYER,
+ PROP_LAYERNODEEXTRAPROPS,
+ PROP_CRS,
+ PROP_TYPE,
+ PROP_WKB,
+ PROP_WKT,
+ PROP_GEOM
+ };
+
+ Label LABEL_LAYER = Label.label("SpatialLayer");
+
+ // OpenGIS geometry type numbers
+
+ int GTYPE_GEOMETRY = 0;
+ int GTYPE_POINT = 1;
+ int GTYPE_LINESTRING = 2;
+ int GTYPE_POLYGON = 3;
+ int GTYPE_MULTIPOINT = 4;
+ int GTYPE_MULTILINESTRING = 5;
+ int GTYPE_MULTIPOLYGON = 6;
+
+ int SRID_COORDINATES_2D = 4326;
+ int SRID_COORDINATES_3D = 4979;
+
+ String INDEX_TYPE_RTREE = "rtree";
+ String INDEX_TYPE_GEOHASH = "geohash";
+ String INDEX_TYPE_ZORDER = "zorder";
+ String INDEX_TYPE_HILBERT = "hilbert";
+
+ String WGS84_CRS_NAME = "wgs84";
+
+
+ String DOC_LAYER_NAME = "The name of the layer";
+ String DOC_LAYER_TYPE = "The type of the new layer. Existing layer types can be queried by `spatial.layer`";
+ String DOC_ENCODER_CONFIG = "The configuration of the encoder that is used by layer to en-/decode the geometry of indexed nodes";
+ String DOC_INDEX_CONFIG = "The configuration of the newly created index";
+ String DOC_ENCODER_NAME = "The name of the encoder to be used for the new layer";
+ String DOC_INDEX_TYPE =
+ "The type of the index algorithm to be used, valid values are: `" + INDEX_TYPE_RTREE + "`, `"
+ + INDEX_TYPE_GEOHASH + "`, `" + INDEX_TYPE_ZORDER + "` or `" + INDEX_TYPE_HILBERT + "`";
+ String DOC_CRS = "The CRS to be used, valid values are: `" + WGS84_CRS_NAME + "`";
+ String DOC_COORDINATE = """
+ A valid value for the coordinate is a:
+
+ * JTS Coordinate
+ * Neo4j Coordinate
+ * Neo4j Point
+ * Map with keys 'latitude' and 'longitude'
+ * Map with keys 'lat' and 'lon'"
+ * Node or Relationship with properties 'latitude' and 'longitude'
+ * Node or Relationship with properties 'lat' and 'lon'
+ """;
+ String DOC_URI = "The path of the file to import the data from";
+
+ String DOC_JTS_GEOMETRY = "A WKT string or a coordinate. " + DOC_COORDINATE;
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/DefaultLayer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/DefaultLayer.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/DefaultLayer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/DefaultLayer.java
diff --git a/src/main/java/org/neo4j/gis/spatial/DynamicLayer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/DynamicLayer.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/DynamicLayer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/DynamicLayer.java
diff --git a/src/main/java/org/neo4j/gis/spatial/DynamicLayerConfig.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/DynamicLayerConfig.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/DynamicLayerConfig.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/DynamicLayerConfig.java
diff --git a/src/main/java/org/neo4j/gis/spatial/EditableLayer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/EditableLayer.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/EditableLayer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/EditableLayer.java
diff --git a/src/main/java/org/neo4j/gis/spatial/EditableLayerImpl.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/EditableLayerImpl.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/EditableLayerImpl.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/EditableLayerImpl.java
diff --git a/src/main/java/org/neo4j/gis/spatial/GeometryEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/GeometryEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/GeometryEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/GeometryEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/Layer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/Layer.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/Layer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/Layer.java
index 9aae8c6ff..55f9463cb 100644
--- a/src/main/java/org/neo4j/gis/spatial/Layer.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/Layer.java
@@ -1,159 +1,159 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import java.util.List;
-import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
-import org.locationtech.jts.geom.GeometryFactory;
-import org.neo4j.gis.spatial.attributes.PropertyMappingManager;
-import org.neo4j.gis.spatial.index.IndexManager;
-import org.neo4j.gis.spatial.index.LayerIndexReader;
-import org.neo4j.gis.spatial.rtree.Listener;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-
-
-/**
- * Instances of Layer provide the ability for developers to add/remove and edit geometries
- * associated with a single dataset (or layer). This includes support for several storage
- * mechanisms, like in-node (geometries in properties) and sub-graph (geometries describe by the
- * graph). A Layer can be associated with a dataset. In cases where the dataset contains only one
- * layer, the layer itself is the dataset. See the class DefaultLayer for the standard
- * implementation of that pattern.
- */
-public interface Layer {
-
- /**
- * The layer is constructed from metadata in the layer node, which requires that the layer have
- * a no-argument constructor. The real initialization of the layer is then performed by calling
- * this method. The layer implementation can store the passed parameters for later use
- * satisfying the prupose of the layer API (see other Layer methods).
- */
- void initialize(Transaction tx, IndexManager indexManager, String name, Node layerNode);
-
- /**
- * Every layer using a specific implementation of the SpatialIndexReader and SpatialIndexWriter
- * for indexing the data in that layer.
- *
- * @return the SpatialIndexReader used to perform searches on the data in the layer
- */
- LayerIndexReader getIndex();
-
- /**
- * This method adds existing geometries to the layer for indexing. After this method is called the geometry should
- * be searchable.
- *
- * @param geomNode the node containing the geometry to be added to the layer
- * @return SpatialDatabaseRecord representation of the geometry added to the database
- */
- SpatialDatabaseRecord add(Transaction tx, Node geomNode);
-
- /**
- * This method adds existing geometries to the layer for indexing in bulk. After this method is called the geometry
- * should be searchable.
- *
- * @param geomNodes the nodes containing the geometries to be added to the layer
- * @return the number of geometries added to the database
- */
- int addAll(Transaction tx, List geomNodes);
-
- GeometryFactory getGeometryFactory();
-
- /**
- * All layers are associated with a single node in the database. This node will have properties,
- * relationships (sub-graph) or both to describe the contents of the layer
- */
- Node getLayerNode(Transaction tx);
-
- /**
- * Delete the entire layer, including the index. The specific layer implementation will decide
- * if this method should delete also the geometry nodes indexed by this layer. Some
- * implementations have data that only has meaning within a layer, and so will be deleted.
- * Others are simply views onto other more complex data models and deleting the geometry nodes
- * might imply damage to the model. Keep this in mind when coding implementations of the Layer.
- */
- void delete(Transaction tx, Listener monitor);
-
- /**
- * Every layer is defined by a unique name. Uniqueness is not enforced, but lack of uniqueness
- * will not guarrantee the right layer returned from a search.
- */
- String getName();
-
- /**
- * Each layer can contain geometries stored in the database in a custom way. Classes that
- * implement the layer should also provide appropriate GeometryEncoders for encoding and
- * decoding the geometries. This can be either as properties of a geometry node, or as
- * sub-graphs accessible from some geometry node.
- *
- * @return implementation of the GemoetryEncoder class enabling encoding/decoding of geometries
- * from the graph
- */
- GeometryEncoder getGeometryEncoder();
-
- /**
- * Each layer can represent data stored in a specific coordinate refernece system, or
- * projection.
- */
- CoordinateReferenceSystem getCoordinateReferenceSystem(Transaction tx);
-
- /**
- * Each layer contains geometries with optional attributes.
- *
- * @param tx the transaction
- * @return String array of all attribute names
- */
- String[] getExtraPropertyNames(Transaction tx);
-
- /**
- * The layer conforms with the Geotools pattern of only allowing a single geometry per layer.
- *
- * @return integer key for the geotools geometry type
- */
- Integer getGeometryType(Transaction tx);
-
- /**
- * Each layer is associated with a SpatialDataset. This can be a one-for-one match to the layer,
- * or can be expressed as many layers on a single dataset.
- *
- * @return SpatialDataset containing the data indexed by this layer.
- */
- SpatialDataset getDataset();
-
- /**
- * Each layer can optionally provide a style to be used in rendering this
- * layer. Return null if you wish to leave this choice to the GIS. If a
- * Style is returned, it is used. If a File is returned, it is opened and
- * assumed to contain SLD contents. If a String is returned, it is assumed
- * to contain SLD contents.
- *
- * @return Style, String, File or null
- */
- Object getStyle();
-
- PropertyMappingManager getPropertyMappingManager();
-
- /**
- * For external expression of the configuration of this layer
- *
- * @return descriptive signature of layer, name, type and encoder
- */
- String getSignature();
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import java.util.List;
+import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
+import org.locationtech.jts.geom.GeometryFactory;
+import org.neo4j.gis.spatial.attributes.PropertyMappingManager;
+import org.neo4j.gis.spatial.index.IndexManager;
+import org.neo4j.gis.spatial.index.LayerIndexReader;
+import org.neo4j.gis.spatial.rtree.Listener;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+
+
+/**
+ * Instances of Layer provide the ability for developers to add/remove and edit geometries
+ * associated with a single dataset (or layer). This includes support for several storage
+ * mechanisms, like in-node (geometries in properties) and sub-graph (geometries describe by the
+ * graph). A Layer can be associated with a dataset. In cases where the dataset contains only one
+ * layer, the layer itself is the dataset. See the class DefaultLayer for the standard
+ * implementation of that pattern.
+ */
+public interface Layer {
+
+ /**
+ * The layer is constructed from metadata in the layer node, which requires that the layer have
+ * a no-argument constructor. The real initialization of the layer is then performed by calling
+ * this method. The layer implementation can store the passed parameters for later use
+ * satisfying the prupose of the layer API (see other Layer methods).
+ */
+ void initialize(Transaction tx, IndexManager indexManager, String name, Node layerNode);
+
+ /**
+ * Every layer using a specific implementation of the SpatialIndexReader and SpatialIndexWriter
+ * for indexing the data in that layer.
+ *
+ * @return the SpatialIndexReader used to perform searches on the data in the layer
+ */
+ LayerIndexReader getIndex();
+
+ /**
+ * This method adds existing geometries to the layer for indexing. After this method is called the geometry should
+ * be searchable.
+ *
+ * @param geomNode the node containing the geometry to be added to the layer
+ * @return SpatialDatabaseRecord representation of the geometry added to the database
+ */
+ SpatialDatabaseRecord add(Transaction tx, Node geomNode);
+
+ /**
+ * This method adds existing geometries to the layer for indexing in bulk. After this method is called the geometry
+ * should be searchable.
+ *
+ * @param geomNodes the nodes containing the geometries to be added to the layer
+ * @return the number of geometries added to the database
+ */
+ int addAll(Transaction tx, List geomNodes);
+
+ GeometryFactory getGeometryFactory();
+
+ /**
+ * All layers are associated with a single node in the database. This node will have properties,
+ * relationships (sub-graph) or both to describe the contents of the layer
+ */
+ Node getLayerNode(Transaction tx);
+
+ /**
+ * Delete the entire layer, including the index. The specific layer implementation will decide
+ * if this method should delete also the geometry nodes indexed by this layer. Some
+ * implementations have data that only has meaning within a layer, and so will be deleted.
+ * Others are simply views onto other more complex data models and deleting the geometry nodes
+ * might imply damage to the model. Keep this in mind when coding implementations of the Layer.
+ */
+ void delete(Transaction tx, Listener monitor);
+
+ /**
+ * Every layer is defined by a unique name. Uniqueness is not enforced, but lack of uniqueness
+ * will not guarrantee the right layer returned from a search.
+ */
+ String getName();
+
+ /**
+ * Each layer can contain geometries stored in the database in a custom way. Classes that
+ * implement the layer should also provide appropriate GeometryEncoders for encoding and
+ * decoding the geometries. This can be either as properties of a geometry node, or as
+ * sub-graphs accessible from some geometry node.
+ *
+ * @return implementation of the GemoetryEncoder class enabling encoding/decoding of geometries
+ * from the graph
+ */
+ GeometryEncoder getGeometryEncoder();
+
+ /**
+ * Each layer can represent data stored in a specific coordinate refernece system, or
+ * projection.
+ */
+ CoordinateReferenceSystem getCoordinateReferenceSystem(Transaction tx);
+
+ /**
+ * Each layer contains geometries with optional attributes.
+ *
+ * @param tx the transaction
+ * @return String array of all attribute names
+ */
+ String[] getExtraPropertyNames(Transaction tx);
+
+ /**
+ * The layer conforms with the Geotools pattern of only allowing a single geometry per layer.
+ *
+ * @return integer key for the geotools geometry type
+ */
+ Integer getGeometryType(Transaction tx);
+
+ /**
+ * Each layer is associated with a SpatialDataset. This can be a one-for-one match to the layer,
+ * or can be expressed as many layers on a single dataset.
+ *
+ * @return SpatialDataset containing the data indexed by this layer.
+ */
+ SpatialDataset getDataset();
+
+ /**
+ * Each layer can optionally provide a style to be used in rendering this
+ * layer. Return null if you wish to leave this choice to the GIS. If a
+ * Style is returned, it is used. If a File is returned, it is opened and
+ * assumed to contain SLD contents. If a String is returned, it is assumed
+ * to contain SLD contents.
+ *
+ * @return Style, String, File or null
+ */
+ Object getStyle();
+
+ PropertyMappingManager getPropertyMappingManager();
+
+ /**
+ * For external expression of the configuration of this layer
+ *
+ * @return descriptive signature of layer, name, type and encoder
+ */
+ String getSignature();
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/LineStringNetworkGenerator.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/LineStringNetworkGenerator.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/LineStringNetworkGenerator.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/LineStringNetworkGenerator.java
diff --git a/src/main/java/org/neo4j/gis/spatial/OrderedEditableLayer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/OrderedEditableLayer.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/OrderedEditableLayer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/OrderedEditableLayer.java
diff --git a/src/main/java/org/neo4j/gis/spatial/ShapefileExporter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/ShapefileExporter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/ShapefileExporter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/ShapefileExporter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/ShapefileImporter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/ShapefileImporter.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/ShapefileImporter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/ShapefileImporter.java
index 4b60572ff..8ab21b9a9 100644
--- a/src/main/java/org/neo4j/gis/spatial/ShapefileImporter.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/ShapefileImporter.java
@@ -1,288 +1,288 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import org.geotools.api.referencing.FactoryException;
-import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
-import org.geotools.data.PrjFileReader;
-import org.geotools.data.shapefile.dbf.DbaseFileHeader;
-import org.geotools.data.shapefile.dbf.DbaseFileReader;
-import org.geotools.data.shapefile.files.ShpFileType;
-import org.geotools.data.shapefile.files.ShpFiles;
-import org.geotools.data.shapefile.shp.JTSUtilities;
-import org.geotools.data.shapefile.shp.ShapefileReader;
-import org.geotools.data.shapefile.shp.ShapefileReader.Record;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.geom.GeometryFactory;
-import org.neo4j.dbms.api.DatabaseManagementService;
-import org.neo4j.dbms.api.DatabaseManagementServiceBuilder;
-import org.neo4j.gis.spatial.index.IndexManager;
-import org.neo4j.gis.spatial.rtree.Listener;
-import org.neo4j.gis.spatial.rtree.NullListener;
-import org.neo4j.graphdb.GraphDatabaseService;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-import org.neo4j.internal.kernel.api.security.SecurityContext;
-import org.neo4j.kernel.internal.GraphDatabaseAPI;
-
-public class ShapefileImporter implements Constants {
-
- private final int commitInterval;
- private final boolean maintainGeometryOrder;
- private final Listener monitor;
- private final GraphDatabaseService database;
- private final SpatialDatabaseService spatialDatabase;
- private Envelope filterEnvelope;
-
- public ShapefileImporter(GraphDatabaseService database, Listener monitor, int commitInterval,
- boolean maintainGeometryOrder) {
- this.maintainGeometryOrder = maintainGeometryOrder;
- if (commitInterval < 1) {
- throw new IllegalArgumentException("commitInterval must be > 0");
- }
- this.commitInterval = commitInterval;
- this.database = database;
- this.spatialDatabase = new SpatialDatabaseService(
- new IndexManager((GraphDatabaseAPI) database, SecurityContext.AUTH_DISABLED));
-
- if (monitor == null) {
- monitor = new NullListener();
- }
- this.monitor = monitor;
- }
-
- public ShapefileImporter(GraphDatabaseService database, Listener monitor, int commitInterval) {
- this(database, monitor, commitInterval, false);
- }
-
- public ShapefileImporter(GraphDatabaseService database, Listener monitor) {
- this(database, monitor, 1000, false);
- }
-
- public ShapefileImporter(GraphDatabaseService database) {
- this(database, null, 1000, false);
- }
-
- public void setFilterEnvelope(Envelope filterEnvelope) {
- this.filterEnvelope = filterEnvelope;
- }
-
- public List importFile(String dataset, String layerName) throws IOException {
- return importFile(dataset, layerName, Charset.defaultCharset());
- }
-
- public List importFile(String dataset, String layerName, Charset charset) throws IOException {
- Class extends Layer> layerClass =
- maintainGeometryOrder ? OrderedEditableLayer.class : EditableLayerImpl.class;
- EditableLayerImpl layer;
- try (Transaction tx = database.beginTx()) {
- layer = (EditableLayerImpl) spatialDatabase.getOrCreateLayer(tx, layerName, WKBGeometryEncoder.class,
- layerClass, null);
- tx.commit();
- }
- return importFile(dataset, layer, charset);
- }
-
- public List importFile(String dataset, EditableLayerImpl layer, Charset charset) throws IOException {
- GeometryFactory geomFactory = layer.getGeometryFactory();
- ArrayList added = new ArrayList<>();
-
- long startTime = System.currentTimeMillis();
-
- ShpFiles shpFiles;
- try {
- shpFiles = new ShpFiles(new File(dataset));
- } catch (Exception e) {
- try {
- shpFiles = new ShpFiles(new File(dataset + ".shp"));
- } catch (Exception e2) {
- throw new IllegalArgumentException(
- "Failed to access the shapefile at either '" + dataset + "' or '" + dataset + ".shp'", e);
- }
- }
-
- try (ShapefileReader shpReader = new ShapefileReader(shpFiles, false, true, geomFactory)) {
- Class extends Geometry> geometryClass = JTSUtilities.findBestGeometryClass(
- shpReader.getHeader().getShapeType());
- int geometryType = SpatialDatabaseService.convertJtsClassToGeometryType(geometryClass);
-
- // TODO ask charset to user?
- try (DbaseFileReader dbfReader = new DbaseFileReader(shpFiles, true, charset)) {
- DbaseFileHeader dbaseFileHeader = dbfReader.getHeader();
-
- String[] fieldsName = new String[dbaseFileHeader.getNumFields() + 1];
- fieldsName[0] = "ID";
- for (int i = 1; i < fieldsName.length; i++) {
- fieldsName[i] = dbaseFileHeader.getFieldName(i - 1);
- }
-
- try (var tx = database.beginTx()) {
- CoordinateReferenceSystem crs = readCRS(shpFiles, shpReader);
- if (crs != null) {
- layer.setCoordinateReferenceSystem(tx, crs);
- }
-
- layer.setGeometryType(tx, geometryType);
-
- layer.mergeExtraPropertyNames(tx, fieldsName);
- tx.commit();
- }
-
- monitor.begin(dbaseFileHeader.getNumRecords());
- try {
- Record record;
- Geometry geometry;
- Object[] values;
- ArrayList fields = new ArrayList<>();
- int recordCounter = 0;
- int filterCounter = 0;
- while (shpReader.hasNext() && dbfReader.hasNext()) {
- try (var tx = database.beginTx()) {
- int committedSinceLastNotification = 0;
- for (int i = 0; i < commitInterval; i++) {
- if (shpReader.hasNext() && dbfReader.hasNext()) {
- record = shpReader.nextRecord();
- recordCounter++;
- committedSinceLastNotification++;
- try {
- fields.clear();
- geometry = (Geometry) record.shape();
- if (filterEnvelope == null || filterEnvelope.intersects(
- geometry.getEnvelopeInternal())) {
- values = dbfReader.readEntry();
-
- //convert Date to String
- //necessary because Neo4j doesn't support Date properties on nodes
- for (int k = 0; k < fieldsName.length - 1; k++) {
- if (values[k] instanceof Date aux) {
- values[k] = aux.toString();
- }
- }
-
- fields.add(recordCounter);
- Collections.addAll(fields, values);
- if (geometry.isEmpty()) {
- log("warn | found empty geometry in record " + recordCounter);
- } else {
- // TODO check geometry.isValid()
- // ?
- SpatialDatabaseRecord spatial_record = layer.add(tx, geometry,
- fieldsName, fields.toArray(values));
- added.add(spatial_record.getGeomNode());
- }
- } else {
- filterCounter++;
- }
- } catch (IllegalArgumentException e) {
- // org.geotools.data.shapefile.shp.ShapefileReader.Record.shape() can throw this exception
- log("warn | found invalid geometry: index=" + recordCounter, e);
- }
- }
- }
- monitor.worked(committedSinceLastNotification);
- tx.commit();
-
- log("info | inserted geometries: " + (recordCounter - filterCounter));
- if (filterCounter > 0) {
- log("info | ignored " + filterCounter + "/" + recordCounter
- + " geometries outside filter envelope: " + filterEnvelope);
- }
- }
- }
- } finally {
- monitor.done();
- }
- }
- }
- try (Transaction tx = database.beginTx()) {
- layer.finalizeTransaction(tx);
- tx.commit();
- }
-
- long stopTime = System.currentTimeMillis();
- log("info | elapsed time in seconds: " + (1.0 * (stopTime - startTime) / 1000));
- return added;
- }
-
- private static CoordinateReferenceSystem readCRS(ShpFiles shpFiles, ShapefileReader shpReader) {
- try (PrjFileReader prjReader = new PrjFileReader(shpFiles.getReadChannel(ShpFileType.PRJ, shpReader))) {
- return prjReader.getCoordinateReferenceSystem();
- } catch (IOException | FactoryException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- private static void log(String message) {
- System.out.println(message);
- }
-
- private static void log(String message, Exception e) {
- System.out.println(message);
- e.printStackTrace();
- }
-
- public static void main(String[] args) throws Exception {
- String neoPath;
- String database;
- String shpPath;
- String layerName;
- int commitInterval = 1000;
-
- if (args.length < 3 || args.length > 5) {
- System.err.println("Parameters: neo4jDirectory database shapefile [layerName commitInterval]");
- System.err.println(
- "\tNote: 'database' can only be something other than 'neo4j' in Neo4j Enterprise Edition.");
- System.exit(1);
- }
-
- neoPath = args[0];
- database = args[1];
- shpPath = args[2];
- shpPath = shpPath.substring(0, shpPath.lastIndexOf("."));
-
- if (args.length == 3) {
- layerName = shpPath.substring(shpPath.lastIndexOf(File.separator) + 1);
- } else if (args.length == 4) {
- layerName = args[3];
- } else {
- layerName = args[3];
- commitInterval = Integer.parseInt(args[4]);
- }
-
- DatabaseManagementService databases = new DatabaseManagementServiceBuilder(Path.of(neoPath)).build();
- GraphDatabaseService db = databases.database(database);
- try {
- ShapefileImporter importer = new ShapefileImporter(db, new NullListener(), commitInterval);
- importer.importFile(shpPath, layerName);
- } finally {
- databases.shutdown();
- }
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import org.geotools.api.referencing.FactoryException;
+import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
+import org.geotools.data.PrjFileReader;
+import org.geotools.data.shapefile.dbf.DbaseFileHeader;
+import org.geotools.data.shapefile.dbf.DbaseFileReader;
+import org.geotools.data.shapefile.files.ShpFileType;
+import org.geotools.data.shapefile.files.ShpFiles;
+import org.geotools.data.shapefile.shp.JTSUtilities;
+import org.geotools.data.shapefile.shp.ShapefileReader;
+import org.geotools.data.shapefile.shp.ShapefileReader.Record;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.GeometryFactory;
+import org.neo4j.dbms.api.DatabaseManagementService;
+import org.neo4j.dbms.api.DatabaseManagementServiceBuilder;
+import org.neo4j.gis.spatial.index.IndexManager;
+import org.neo4j.gis.spatial.rtree.Listener;
+import org.neo4j.gis.spatial.rtree.NullListener;
+import org.neo4j.graphdb.GraphDatabaseService;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+import org.neo4j.internal.kernel.api.security.SecurityContext;
+import org.neo4j.kernel.internal.GraphDatabaseAPI;
+
+public class ShapefileImporter implements Constants {
+
+ private final int commitInterval;
+ private final boolean maintainGeometryOrder;
+ private final Listener monitor;
+ private final GraphDatabaseService database;
+ private final SpatialDatabaseService spatialDatabase;
+ private Envelope filterEnvelope;
+
+ public ShapefileImporter(GraphDatabaseService database, Listener monitor, int commitInterval,
+ boolean maintainGeometryOrder) {
+ this.maintainGeometryOrder = maintainGeometryOrder;
+ if (commitInterval < 1) {
+ throw new IllegalArgumentException("commitInterval must be > 0");
+ }
+ this.commitInterval = commitInterval;
+ this.database = database;
+ this.spatialDatabase = new SpatialDatabaseService(
+ new IndexManager((GraphDatabaseAPI) database, SecurityContext.AUTH_DISABLED));
+
+ if (monitor == null) {
+ monitor = new NullListener();
+ }
+ this.monitor = monitor;
+ }
+
+ public ShapefileImporter(GraphDatabaseService database, Listener monitor, int commitInterval) {
+ this(database, monitor, commitInterval, false);
+ }
+
+ public ShapefileImporter(GraphDatabaseService database, Listener monitor) {
+ this(database, monitor, 1000, false);
+ }
+
+ public ShapefileImporter(GraphDatabaseService database) {
+ this(database, null, 1000, false);
+ }
+
+ public void setFilterEnvelope(Envelope filterEnvelope) {
+ this.filterEnvelope = filterEnvelope;
+ }
+
+ public List importFile(String dataset, String layerName) throws IOException {
+ return importFile(dataset, layerName, Charset.defaultCharset());
+ }
+
+ public List importFile(String dataset, String layerName, Charset charset) throws IOException {
+ Class extends Layer> layerClass =
+ maintainGeometryOrder ? OrderedEditableLayer.class : EditableLayerImpl.class;
+ EditableLayerImpl layer;
+ try (Transaction tx = database.beginTx()) {
+ layer = (EditableLayerImpl) spatialDatabase.getOrCreateLayer(tx, layerName, WKBGeometryEncoder.class,
+ layerClass, null);
+ tx.commit();
+ }
+ return importFile(dataset, layer, charset);
+ }
+
+ public List importFile(String dataset, EditableLayerImpl layer, Charset charset) throws IOException {
+ GeometryFactory geomFactory = layer.getGeometryFactory();
+ ArrayList added = new ArrayList<>();
+
+ long startTime = System.currentTimeMillis();
+
+ ShpFiles shpFiles;
+ try {
+ shpFiles = new ShpFiles(new File(dataset));
+ } catch (Exception e) {
+ try {
+ shpFiles = new ShpFiles(new File(dataset + ".shp"));
+ } catch (Exception e2) {
+ throw new IllegalArgumentException(
+ "Failed to access the shapefile at either '" + dataset + "' or '" + dataset + ".shp'", e);
+ }
+ }
+
+ try (ShapefileReader shpReader = new ShapefileReader(shpFiles, false, true, geomFactory)) {
+ Class extends Geometry> geometryClass = JTSUtilities.findBestGeometryClass(
+ shpReader.getHeader().getShapeType());
+ int geometryType = SpatialDatabaseService.convertJtsClassToGeometryType(geometryClass);
+
+ // TODO ask charset to user?
+ try (DbaseFileReader dbfReader = new DbaseFileReader(shpFiles, true, charset)) {
+ DbaseFileHeader dbaseFileHeader = dbfReader.getHeader();
+
+ String[] fieldsName = new String[dbaseFileHeader.getNumFields() + 1];
+ fieldsName[0] = "ID";
+ for (int i = 1; i < fieldsName.length; i++) {
+ fieldsName[i] = dbaseFileHeader.getFieldName(i - 1);
+ }
+
+ try (var tx = database.beginTx()) {
+ CoordinateReferenceSystem crs = readCRS(shpFiles, shpReader);
+ if (crs != null) {
+ layer.setCoordinateReferenceSystem(tx, crs);
+ }
+
+ layer.setGeometryType(tx, geometryType);
+
+ layer.mergeExtraPropertyNames(tx, fieldsName);
+ tx.commit();
+ }
+
+ monitor.begin(dbaseFileHeader.getNumRecords());
+ try {
+ Record record;
+ Geometry geometry;
+ Object[] values;
+ ArrayList fields = new ArrayList<>();
+ int recordCounter = 0;
+ int filterCounter = 0;
+ while (shpReader.hasNext() && dbfReader.hasNext()) {
+ try (var tx = database.beginTx()) {
+ int committedSinceLastNotification = 0;
+ for (int i = 0; i < commitInterval; i++) {
+ if (shpReader.hasNext() && dbfReader.hasNext()) {
+ record = shpReader.nextRecord();
+ recordCounter++;
+ committedSinceLastNotification++;
+ try {
+ fields.clear();
+ geometry = (Geometry) record.shape();
+ if (filterEnvelope == null || filterEnvelope.intersects(
+ geometry.getEnvelopeInternal())) {
+ values = dbfReader.readEntry();
+
+ //convert Date to String
+ //necessary because Neo4j doesn't support Date properties on nodes
+ for (int k = 0; k < fieldsName.length - 1; k++) {
+ if (values[k] instanceof Date aux) {
+ values[k] = aux.toString();
+ }
+ }
+
+ fields.add(recordCounter);
+ Collections.addAll(fields, values);
+ if (geometry.isEmpty()) {
+ log("warn | found empty geometry in record " + recordCounter);
+ } else {
+ // TODO check geometry.isValid()
+ // ?
+ SpatialDatabaseRecord spatial_record = layer.add(tx, geometry,
+ fieldsName, fields.toArray(values));
+ added.add(spatial_record.getGeomNode());
+ }
+ } else {
+ filterCounter++;
+ }
+ } catch (IllegalArgumentException e) {
+ // org.geotools.data.shapefile.shp.ShapefileReader.Record.shape() can throw this exception
+ log("warn | found invalid geometry: index=" + recordCounter, e);
+ }
+ }
+ }
+ monitor.worked(committedSinceLastNotification);
+ tx.commit();
+
+ log("info | inserted geometries: " + (recordCounter - filterCounter));
+ if (filterCounter > 0) {
+ log("info | ignored " + filterCounter + "/" + recordCounter
+ + " geometries outside filter envelope: " + filterEnvelope);
+ }
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+ }
+ try (Transaction tx = database.beginTx()) {
+ layer.finalizeTransaction(tx);
+ tx.commit();
+ }
+
+ long stopTime = System.currentTimeMillis();
+ log("info | elapsed time in seconds: " + (1.0 * (stopTime - startTime) / 1000));
+ return added;
+ }
+
+ private static CoordinateReferenceSystem readCRS(ShpFiles shpFiles, ShapefileReader shpReader) {
+ try (PrjFileReader prjReader = new PrjFileReader(shpFiles.getReadChannel(ShpFileType.PRJ, shpReader))) {
+ return prjReader.getCoordinateReferenceSystem();
+ } catch (IOException | FactoryException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private static void log(String message) {
+ System.out.println(message);
+ }
+
+ private static void log(String message, Exception e) {
+ System.out.println(message);
+ e.printStackTrace();
+ }
+
+ public static void main(String[] args) throws Exception {
+ String neoPath;
+ String database;
+ String shpPath;
+ String layerName;
+ int commitInterval = 1000;
+
+ if (args.length < 3 || args.length > 5) {
+ System.err.println("Parameters: neo4jDirectory database shapefile [layerName commitInterval]");
+ System.err.println(
+ "\tNote: 'database' can only be something other than 'neo4j' in Neo4j Enterprise Edition.");
+ System.exit(1);
+ }
+
+ neoPath = args[0];
+ database = args[1];
+ shpPath = args[2];
+ shpPath = shpPath.substring(0, shpPath.lastIndexOf("."));
+
+ if (args.length == 3) {
+ layerName = shpPath.substring(shpPath.lastIndexOf(File.separator) + 1);
+ } else if (args.length == 4) {
+ layerName = args[3];
+ } else {
+ layerName = args[3];
+ commitInterval = Integer.parseInt(args[4]);
+ }
+
+ DatabaseManagementService databases = new DatabaseManagementServiceBuilder(Path.of(neoPath)).build();
+ GraphDatabaseService db = databases.database(database);
+ try {
+ ShapefileImporter importer = new ShapefileImporter(db, new NullListener(), commitInterval);
+ importer.importFile(shpPath, layerName);
+ } finally {
+ databases.shutdown();
+ }
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/SimplePointLayer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SimplePointLayer.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/SimplePointLayer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SimplePointLayer.java
diff --git a/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseException.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseException.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/SpatialDatabaseException.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseException.java
index c230fb4d4..50d40d369 100644
--- a/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseException.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseException.java
@@ -1,40 +1,40 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-
-/**
- * @author Davide Savazzi
- */
-public class SpatialDatabaseException extends RuntimeException {
-
- public SpatialDatabaseException(Throwable error) {
- super(error);
- }
-
- public SpatialDatabaseException(String message, Throwable error) {
- super(message, error);
- }
-
- public SpatialDatabaseException(String message) {
- super(message);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+
+/**
+ * @author Davide Savazzi
+ */
+public class SpatialDatabaseException extends RuntimeException {
+
+ public SpatialDatabaseException(Throwable error) {
+ super(error);
+ }
+
+ public SpatialDatabaseException(String message, Throwable error) {
+ super(message, error);
+ }
+
+ public SpatialDatabaseException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseRecord.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseRecord.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/SpatialDatabaseRecord.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseRecord.java
index ae0070b55..b8a382098 100644
--- a/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseRecord.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseRecord.java
@@ -1,201 +1,201 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.attributes.PropertyMapper;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-
-public class SpatialDatabaseRecord implements Constants, SpatialRecord {
-
- private Node geomNode;
- private Geometry geometry;
- private final Layer layer;
-
- public SpatialDatabaseRecord(Layer layer, Node geomNode) {
- this(layer, geomNode, null);
- }
-
- @Override
- public String getId() {
- return geomNode.getElementId();
- }
-
- public String getNodeId() {
- return getId();
- }
-
- @Override
- public Node getGeomNode() {
- return geomNode;
- }
-
- /**
- * If the geomNode is to be used in a different transaction than the one in which it was created, we must call this
- * first
- */
- public void refreshGeomNode(Transaction tx) {
- geomNode = tx.getNodeByElementId(geomNode.getElementId());
- }
-
- /**
- * This method returns a simple integer representation of the geometry. Some
- * geometry encoders store this directly as a property of the geometry node,
- * while others might store this information elsewhere in the graph, or
- * deduce it from other factors of the data model. See the GeometryEncoder
- * for information about mapping from the data model to the geometry.
- *
- * @return integer representation of a geometry
- * @deprecated This method is of questionable value, since it is better to
- * query the geometry object directly, outside the result
- */
- @Deprecated
- public int getType() {
- //TODO: Get the type from the geometryEncoder
- return SpatialDatabaseService.convertJtsClassToGeometryType(getGeometry().getClass());
- }
-
- @Override
- public Geometry getGeometry() {
- if (geometry == null) {
- geometry = layer.getGeometryEncoder().decodeGeometry(geomNode);
- }
- return geometry;
- }
-
- public CoordinateReferenceSystem getCoordinateReferenceSystem(Transaction tx) {
- return layer.getCoordinateReferenceSystem(tx);
- }
-
- public String getLayerName() {
- return layer.getName();
- }
-
- /**
- * Not all geometry records have the same attribute set, so we should test
- * for each specific record if it contains that property.
- */
- @Override
- public boolean hasProperty(Transaction tx, String name) {
- PropertyMapper mapper = layer.getPropertyMappingManager().getPropertyMapper(tx, name);
- return mapper == null ? hasGeometryProperty(name) : hasGeometryProperty(mapper.from());
- }
-
- private boolean hasGeometryProperty(String name) {
- return layer.getGeometryEncoder().hasAttribute(geomNode, name);
- }
-
- @Override
- public String[] getPropertyNames(Transaction tx) {
- return layer.getExtraPropertyNames(tx);
- }
-
- public Object[] getPropertyValues(Transaction tx) {
- String[] names = getPropertyNames(tx);
- if (names == null) {
- return null;
- }
- Object[] values = new Object[names.length];
- for (int i = 0; i < names.length; i++) {
- values[i] = getProperty(tx, names[i]);
- }
- return values;
- }
-
- @Override
- public Map getProperties(Transaction tx) {
- Map result = new HashMap<>();
-
- String[] names = getPropertyNames(tx);
- for (String name : names) {
- result.put(name, getProperty(tx, name));
- }
-
- return result;
- }
-
- @Override
- public Object getProperty(Transaction tx, String name) {
- PropertyMapper mapper = layer.getPropertyMappingManager().getPropertyMapper(tx, name);
- return mapper == null ? getGeometryProperty(name) : mapper.map(getGeometryProperty(mapper.from()));
- }
-
- private Object getGeometryProperty(String name) {
- return layer.getGeometryEncoder().getAttribute(geomNode, name);
- }
-
- public void setProperty(String name, Object value) {
- checkIsNotReservedProperty(name);
- geomNode.setProperty(name, value);
- }
-
- @Override
- public int hashCode() {
- return geomNode.getElementId().hashCode();
- }
-
- @Override
- public boolean equals(Object anotherObject) {
- if (!(anotherObject instanceof SpatialDatabaseRecord anotherRecord)) {
- return false;
- }
-
- return Objects.equals(getNodeId(), anotherRecord.getNodeId());
- }
-
- @Override
- public String toString() {
- return "SpatialDatabaseRecord[" + getNodeId() + "]: type='" + getType() + "', props[" + getPropString() + "]";
- }
-
- // Protected Constructors
-
- protected SpatialDatabaseRecord(Layer layer, Node geomNode, Geometry geometry) {
- this.layer = layer;
- this.geomNode = geomNode;
- this.geometry = geometry;
- }
-
- // Private methods
-
- private static void checkIsNotReservedProperty(String name) {
- for (String property : RESERVED_PROPS) {
- if (property.equals(name)) {
- throw new SpatialDatabaseException("Updating not allowed for Reserved Property: " + name);
- }
- }
- }
-
- private String getPropString() {
- StringBuilder text = new StringBuilder();
- for (String key : geomNode.getPropertyKeys()) {
- if (!text.isEmpty()) {
- text.append(", ");
- }
- text.append(key).append(": ").append(geomNode.getProperty(key).toString());
- }
- return text.toString();
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.attributes.PropertyMapper;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+
+public class SpatialDatabaseRecord implements Constants, SpatialRecord {
+
+ private Node geomNode;
+ private Geometry geometry;
+ private final Layer layer;
+
+ public SpatialDatabaseRecord(Layer layer, Node geomNode) {
+ this(layer, geomNode, null);
+ }
+
+ @Override
+ public String getId() {
+ return geomNode.getElementId();
+ }
+
+ public String getNodeId() {
+ return getId();
+ }
+
+ @Override
+ public Node getGeomNode() {
+ return geomNode;
+ }
+
+ /**
+ * If the geomNode is to be used in a different transaction than the one in which it was created, we must call this
+ * first
+ */
+ public void refreshGeomNode(Transaction tx) {
+ geomNode = tx.getNodeByElementId(geomNode.getElementId());
+ }
+
+ /**
+ * This method returns a simple integer representation of the geometry. Some
+ * geometry encoders store this directly as a property of the geometry node,
+ * while others might store this information elsewhere in the graph, or
+ * deduce it from other factors of the data model. See the GeometryEncoder
+ * for information about mapping from the data model to the geometry.
+ *
+ * @return integer representation of a geometry
+ * @deprecated This method is of questionable value, since it is better to
+ * query the geometry object directly, outside the result
+ */
+ @Deprecated
+ public int getType() {
+ //TODO: Get the type from the geometryEncoder
+ return SpatialDatabaseService.convertJtsClassToGeometryType(getGeometry().getClass());
+ }
+
+ @Override
+ public Geometry getGeometry() {
+ if (geometry == null) {
+ geometry = layer.getGeometryEncoder().decodeGeometry(geomNode);
+ }
+ return geometry;
+ }
+
+ public CoordinateReferenceSystem getCoordinateReferenceSystem(Transaction tx) {
+ return layer.getCoordinateReferenceSystem(tx);
+ }
+
+ public String getLayerName() {
+ return layer.getName();
+ }
+
+ /**
+ * Not all geometry records have the same attribute set, so we should test
+ * for each specific record if it contains that property.
+ */
+ @Override
+ public boolean hasProperty(Transaction tx, String name) {
+ PropertyMapper mapper = layer.getPropertyMappingManager().getPropertyMapper(tx, name);
+ return mapper == null ? hasGeometryProperty(name) : hasGeometryProperty(mapper.from());
+ }
+
+ private boolean hasGeometryProperty(String name) {
+ return layer.getGeometryEncoder().hasAttribute(geomNode, name);
+ }
+
+ @Override
+ public String[] getPropertyNames(Transaction tx) {
+ return layer.getExtraPropertyNames(tx);
+ }
+
+ public Object[] getPropertyValues(Transaction tx) {
+ String[] names = getPropertyNames(tx);
+ if (names == null) {
+ return null;
+ }
+ Object[] values = new Object[names.length];
+ for (int i = 0; i < names.length; i++) {
+ values[i] = getProperty(tx, names[i]);
+ }
+ return values;
+ }
+
+ @Override
+ public Map getProperties(Transaction tx) {
+ Map result = new HashMap<>();
+
+ String[] names = getPropertyNames(tx);
+ for (String name : names) {
+ result.put(name, getProperty(tx, name));
+ }
+
+ return result;
+ }
+
+ @Override
+ public Object getProperty(Transaction tx, String name) {
+ PropertyMapper mapper = layer.getPropertyMappingManager().getPropertyMapper(tx, name);
+ return mapper == null ? getGeometryProperty(name) : mapper.map(getGeometryProperty(mapper.from()));
+ }
+
+ private Object getGeometryProperty(String name) {
+ return layer.getGeometryEncoder().getAttribute(geomNode, name);
+ }
+
+ public void setProperty(String name, Object value) {
+ checkIsNotReservedProperty(name);
+ geomNode.setProperty(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return geomNode.getElementId().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object anotherObject) {
+ if (!(anotherObject instanceof SpatialDatabaseRecord anotherRecord)) {
+ return false;
+ }
+
+ return Objects.equals(getNodeId(), anotherRecord.getNodeId());
+ }
+
+ @Override
+ public String toString() {
+ return "SpatialDatabaseRecord[" + getNodeId() + "]: type='" + getType() + "', props[" + getPropString() + "]";
+ }
+
+ // Protected Constructors
+
+ protected SpatialDatabaseRecord(Layer layer, Node geomNode, Geometry geometry) {
+ this.layer = layer;
+ this.geomNode = geomNode;
+ this.geometry = geometry;
+ }
+
+ // Private methods
+
+ private static void checkIsNotReservedProperty(String name) {
+ for (String property : RESERVED_PROPS) {
+ if (property.equals(name)) {
+ throw new SpatialDatabaseException("Updating not allowed for Reserved Property: " + name);
+ }
+ }
+ }
+
+ private String getPropString() {
+ StringBuilder text = new StringBuilder();
+ for (String key : geomNode.getPropertyKeys()) {
+ if (!text.isEmpty()) {
+ text.append(", ");
+ }
+ text.append(key).append(": ").append(geomNode.getProperty(key).toString());
+ }
+ return text.toString();
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseService.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseService.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/SpatialDatabaseService.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDatabaseService.java
diff --git a/src/main/java/org/neo4j/gis/spatial/SpatialDataset.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDataset.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/SpatialDataset.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDataset.java
diff --git a/src/main/java/org/neo4j/gis/spatial/SpatialRecord.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialRecord.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/SpatialRecord.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialRecord.java
diff --git a/src/main/java/org/neo4j/gis/spatial/SpatialRelationshipTypes.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialRelationshipTypes.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/SpatialRelationshipTypes.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialRelationshipTypes.java
index 41996aa0d..5eb788a59 100644
--- a/src/main/java/org/neo4j/gis/spatial/SpatialRelationshipTypes.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialRelationshipTypes.java
@@ -1,30 +1,30 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import org.neo4j.graphdb.RelationshipType;
-
-
-/**
- * @author Davide Savazzi
- */
-public enum SpatialRelationshipTypes implements RelationshipType {
- LAYER, NETWORK, SPATIAL, LAYERS, DATASETS, LAYER_CONFIG, DATASET, PROPERTY_MAPPING
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import org.neo4j.graphdb.RelationshipType;
+
+
+/**
+ * @author Davide Savazzi
+ */
+public enum SpatialRelationshipTypes implements RelationshipType {
+ LAYER, NETWORK, SPATIAL, LAYERS, DATASETS, LAYER_CONFIG, DATASET, PROPERTY_MAPPING
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java
diff --git a/src/main/java/org/neo4j/gis/spatial/Utilities.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/Utilities.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/Utilities.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/Utilities.java
diff --git a/src/main/java/org/neo4j/gis/spatial/WKBGeometryEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/WKBGeometryEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/WKBGeometryEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/WKBGeometryEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/WKTGeometryEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/WKTGeometryEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/WKTGeometryEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/WKTGeometryEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/attributes/PropertyMapper.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/attributes/PropertyMapper.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/attributes/PropertyMapper.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/attributes/PropertyMapper.java
diff --git a/src/main/java/org/neo4j/gis/spatial/attributes/PropertyMappingManager.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/attributes/PropertyMappingManager.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/attributes/PropertyMappingManager.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/attributes/PropertyMappingManager.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/AbstractSinglePropertyEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/AbstractSinglePropertyEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/AbstractSinglePropertyEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/AbstractSinglePropertyEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/Configurable.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/Configurable.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/Configurable.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/Configurable.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/NativePointEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/NativePointEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/NativePointEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/NativePointEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/NativePointsEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/NativePointsEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/NativePointsEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/NativePointsEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/SimplePointEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/SimplePointEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/SimplePointEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/SimplePointEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/SimplePropertyEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/SimplePropertyEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/SimplePropertyEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/SimplePropertyEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jCRS.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jCRS.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jCRS.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jCRS.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jGeometry.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jGeometry.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jGeometry.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jGeometry.java
diff --git a/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jPoint.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jPoint.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jPoint.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/encoders/neo4j/Neo4jPoint.java
diff --git a/src/main/java/org/neo4j/gis/spatial/filter/AbstractSearchIntersection.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/AbstractSearchIntersection.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/filter/AbstractSearchIntersection.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/filter/AbstractSearchIntersection.java
index 1a794aca2..ea21fcf62 100644
--- a/src/main/java/org/neo4j/gis/spatial/filter/AbstractSearchIntersection.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/AbstractSearchIntersection.java
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.filter;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.Layer;
-import org.neo4j.gis.spatial.Utilities;
-import org.neo4j.gis.spatial.rtree.filter.AbstractSearchEnvelopeIntersection;
-import org.neo4j.graphdb.Node;
-
-/**
- * @author Craig Taverner
- */
-public abstract class AbstractSearchIntersection extends AbstractSearchEnvelopeIntersection {
-
- protected final Geometry referenceGeometry;
- protected final Layer layer;
-
- public AbstractSearchIntersection(Layer layer, Geometry referenceGeometry) {
- super(layer.getGeometryEncoder(), Utilities.fromJtsToNeo4j(referenceGeometry.getEnvelopeInternal()));
- this.referenceGeometry = referenceGeometry;
- this.layer = layer;
- }
-
- protected Geometry decode(Node geomNode) {
- return layer.getGeometryEncoder().decodeGeometry(geomNode);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.filter;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.Layer;
+import org.neo4j.gis.spatial.Utilities;
+import org.neo4j.gis.spatial.rtree.filter.AbstractSearchEnvelopeIntersection;
+import org.neo4j.graphdb.Node;
+
+/**
+ * @author Craig Taverner
+ */
+public abstract class AbstractSearchIntersection extends AbstractSearchEnvelopeIntersection {
+
+ protected final Geometry referenceGeometry;
+ protected final Layer layer;
+
+ public AbstractSearchIntersection(Layer layer, Geometry referenceGeometry) {
+ super(layer.getGeometryEncoder(), Utilities.fromJtsToNeo4j(referenceGeometry.getEnvelopeInternal()));
+ this.referenceGeometry = referenceGeometry;
+ this.layer = layer;
+ }
+
+ protected Geometry decode(Node geomNode) {
+ return layer.getGeometryEncoder().decodeGeometry(geomNode);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/filter/SearchCQL.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchCQL.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/filter/SearchCQL.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchCQL.java
index 085811856..63eef4a8c 100644
--- a/src/main/java/org/neo4j/gis/spatial/filter/SearchCQL.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchCQL.java
@@ -1,75 +1,75 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.filter;
-
-import org.geotools.api.feature.simple.SimpleFeature;
-import org.geotools.data.neo4j.Neo4jFeatureBuilder;
-import org.geotools.filter.text.cql2.CQLException;
-import org.geotools.filter.text.ecql.ECQL;
-import org.neo4j.gis.spatial.Layer;
-import org.neo4j.gis.spatial.SpatialDatabaseException;
-import org.neo4j.gis.spatial.SpatialDatabaseRecord;
-import org.neo4j.gis.spatial.Utilities;
-import org.neo4j.gis.spatial.rtree.Envelope;
-import org.neo4j.gis.spatial.rtree.filter.SearchFilter;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-
-/**
- * Find geometries that have at least one point in common with the given
- * geometry
- */
-public class SearchCQL implements SearchFilter {
-
- private final Neo4jFeatureBuilder featureBuilder;
- private final Layer layer;
- private final org.geotools.api.filter.Filter filter;
- private final Envelope filterEnvelope;
-
- public SearchCQL(Transaction tx, Layer layer, org.geotools.api.filter.Filter filter) {
- this.layer = layer;
- this.featureBuilder = Neo4jFeatureBuilder.fromLayer(tx, layer);
- this.filter = filter;
- this.filterEnvelope = Utilities.extractEnvelopeFromFilter(filter);
- }
-
- public SearchCQL(Transaction tx, Layer layer, String cql) {
- this.layer = layer;
- this.featureBuilder = Neo4jFeatureBuilder.fromLayer(tx, layer);
- try {
- this.filter = ECQL.toFilter(cql);
- this.filterEnvelope = Utilities.extractEnvelopeFromFilter(filter);
- } catch (CQLException e) {
- throw new SpatialDatabaseException("CQLException: " + e.getMessage());
- }
- }
-
- @Override
- public boolean needsToVisit(Envelope envelope) {
- return filterEnvelope == null || filterEnvelope.intersects(envelope);
- }
-
- @Override
- public boolean geometryMatches(Transaction tx, Node geomNode) {
- SimpleFeature feature = featureBuilder.buildFeature(tx, new SpatialDatabaseRecord(this.layer, geomNode));
- return filter.evaluate(feature);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.filter;
+
+import org.geotools.api.feature.simple.SimpleFeature;
+import org.geotools.data.neo4j.Neo4jFeatureBuilder;
+import org.geotools.filter.text.cql2.CQLException;
+import org.geotools.filter.text.ecql.ECQL;
+import org.neo4j.gis.spatial.Layer;
+import org.neo4j.gis.spatial.SpatialDatabaseException;
+import org.neo4j.gis.spatial.SpatialDatabaseRecord;
+import org.neo4j.gis.spatial.Utilities;
+import org.neo4j.gis.spatial.rtree.Envelope;
+import org.neo4j.gis.spatial.rtree.filter.SearchFilter;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+
+/**
+ * Find geometries that have at least one point in common with the given
+ * geometry
+ */
+public class SearchCQL implements SearchFilter {
+
+ private final Neo4jFeatureBuilder featureBuilder;
+ private final Layer layer;
+ private final org.geotools.api.filter.Filter filter;
+ private final Envelope filterEnvelope;
+
+ public SearchCQL(Transaction tx, Layer layer, org.geotools.api.filter.Filter filter) {
+ this.layer = layer;
+ this.featureBuilder = Neo4jFeatureBuilder.fromLayer(tx, layer);
+ this.filter = filter;
+ this.filterEnvelope = Utilities.extractEnvelopeFromFilter(filter);
+ }
+
+ public SearchCQL(Transaction tx, Layer layer, String cql) {
+ this.layer = layer;
+ this.featureBuilder = Neo4jFeatureBuilder.fromLayer(tx, layer);
+ try {
+ this.filter = ECQL.toFilter(cql);
+ this.filterEnvelope = Utilities.extractEnvelopeFromFilter(filter);
+ } catch (CQLException e) {
+ throw new SpatialDatabaseException("CQLException: " + e.getMessage());
+ }
+ }
+
+ @Override
+ public boolean needsToVisit(Envelope envelope) {
+ return filterEnvelope == null || filterEnvelope.intersects(envelope);
+ }
+
+ @Override
+ public boolean geometryMatches(Transaction tx, Node geomNode) {
+ SimpleFeature feature = featureBuilder.buildFeature(tx, new SpatialDatabaseRecord(this.layer, geomNode));
+ return filter.evaluate(feature);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersect.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersect.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/filter/SearchIntersect.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersect.java
index 5bba9682c..e9d29338e 100644
--- a/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersect.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersect.java
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.filter;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.Layer;
-import org.neo4j.gis.spatial.rtree.Envelope;
-import org.neo4j.graphdb.Node;
-
-
-/**
- * Find geometries that have at least one point in common with the given geometry
- *
- * @author Davide Savazzi
- * @author Craig Taverner
- */
-public class SearchIntersect extends AbstractSearchIntersection {
-
- public SearchIntersect(Layer layer, Geometry other) {
- super(layer, other);
- }
-
- @Override
- protected boolean onEnvelopeIntersection(Node geomNode, Envelope geomEnvelope) {
- Geometry geometry = decode(geomNode);
- return geometry.intersects(referenceGeometry);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.filter;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.Layer;
+import org.neo4j.gis.spatial.rtree.Envelope;
+import org.neo4j.graphdb.Node;
+
+
+/**
+ * Find geometries that have at least one point in common with the given geometry
+ *
+ * @author Davide Savazzi
+ * @author Craig Taverner
+ */
+public class SearchIntersect extends AbstractSearchIntersection {
+
+ public SearchIntersect(Layer layer, Geometry other) {
+ super(layer, other);
+ }
+
+ @Override
+ protected boolean onEnvelopeIntersection(Node geomNode, Envelope geomEnvelope) {
+ Geometry geometry = decode(geomNode);
+ return geometry.intersects(referenceGeometry);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersectWindow.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersectWindow.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/filter/SearchIntersectWindow.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersectWindow.java
index 235b86e5b..5c6acbbe6 100644
--- a/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersectWindow.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchIntersectWindow.java
@@ -1,88 +1,88 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.filter;
-
-import org.locationtech.jts.algorithm.Orientation;
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.Layer;
-import org.neo4j.gis.spatial.Utilities;
-import org.neo4j.gis.spatial.index.Envelope;
-import org.neo4j.gis.spatial.rtree.filter.AbstractSearchEnvelopeIntersection;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-
-
-/**
- * Find geometries that intersect with the specified search window.
- *
- * @author Craig Taverner
- */
-public class SearchIntersectWindow extends AbstractSearchEnvelopeIntersection {
-
- private final Layer layer;
- private final Geometry windowGeom;
- private final boolean isBBox;
-
- public SearchIntersectWindow(Layer layer, Envelope envelope) {
- this(layer, Utilities.fromNeo4jToJts(envelope));
- }
-
- public SearchIntersectWindow(Layer layer, org.locationtech.jts.geom.Envelope other) {
- super(layer.getGeometryEncoder(), Utilities.fromJtsToNeo4j(other));
- this.layer = layer;
- this.windowGeom = layer.getGeometryFactory().toGeometry(other);
- this.isBBox = this.windowGeom.isRectangle()
- // not a hole
- && !Orientation.isCCW(windowGeom.getCoordinates());
- }
-
- @Override
- public EnvelopFilterResult needsToVisitExtended(org.neo4j.gis.spatial.rtree.Envelope indexNodeEnvelope) {
- if (isBBox && referenceEnvelope.contains(indexNodeEnvelope)) {
- return EnvelopFilterResult.INCLUDE_ALL;
- }
- if (indexNodeEnvelope.intersects(referenceEnvelope)) {
- return EnvelopFilterResult.FILTER;
- }
- return EnvelopFilterResult.EXCLUDE_ALL;
- }
-
- @Override
- public boolean geometryMatches(Transaction tx, Node geomNode) {
- var geomEnvelope = decoder.decodeEnvelope(geomNode);
- if (isBBox && referenceEnvelope.contains(geomEnvelope)) {
- return true;
- }
- if (geomEnvelope.intersects(referenceEnvelope)) {
- return onEnvelopeIntersection(geomNode, geomEnvelope);
- }
- return false;
- }
-
- @Override
- protected boolean onEnvelopeIntersection(Node geomNode, org.neo4j.gis.spatial.rtree.Envelope geomEnvelope) {
- Geometry geometry = layer.getGeometryEncoder().decodeGeometry(geomNode);
- // The next line just calls the method that is causing exceptions on OSM data for testing
- // TODO: Remove when OSM is working properly
- geometry.getEnvelopeInternal();
- return geometry.intersects(windowGeom);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.filter;
+
+import org.locationtech.jts.algorithm.Orientation;
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.Layer;
+import org.neo4j.gis.spatial.Utilities;
+import org.neo4j.gis.spatial.index.Envelope;
+import org.neo4j.gis.spatial.rtree.filter.AbstractSearchEnvelopeIntersection;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+
+
+/**
+ * Find geometries that intersect with the specified search window.
+ *
+ * @author Craig Taverner
+ */
+public class SearchIntersectWindow extends AbstractSearchEnvelopeIntersection {
+
+ private final Layer layer;
+ private final Geometry windowGeom;
+ private final boolean isBBox;
+
+ public SearchIntersectWindow(Layer layer, Envelope envelope) {
+ this(layer, Utilities.fromNeo4jToJts(envelope));
+ }
+
+ public SearchIntersectWindow(Layer layer, org.locationtech.jts.geom.Envelope other) {
+ super(layer.getGeometryEncoder(), Utilities.fromJtsToNeo4j(other));
+ this.layer = layer;
+ this.windowGeom = layer.getGeometryFactory().toGeometry(other);
+ this.isBBox = this.windowGeom.isRectangle()
+ // not a hole
+ && !Orientation.isCCW(windowGeom.getCoordinates());
+ }
+
+ @Override
+ public EnvelopFilterResult needsToVisitExtended(org.neo4j.gis.spatial.rtree.Envelope indexNodeEnvelope) {
+ if (isBBox && referenceEnvelope.contains(indexNodeEnvelope)) {
+ return EnvelopFilterResult.INCLUDE_ALL;
+ }
+ if (indexNodeEnvelope.intersects(referenceEnvelope)) {
+ return EnvelopFilterResult.FILTER;
+ }
+ return EnvelopFilterResult.EXCLUDE_ALL;
+ }
+
+ @Override
+ public boolean geometryMatches(Transaction tx, Node geomNode) {
+ var geomEnvelope = decoder.decodeEnvelope(geomNode);
+ if (isBBox && referenceEnvelope.contains(geomEnvelope)) {
+ return true;
+ }
+ if (geomEnvelope.intersects(referenceEnvelope)) {
+ return onEnvelopeIntersection(geomNode, geomEnvelope);
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean onEnvelopeIntersection(Node geomNode, org.neo4j.gis.spatial.rtree.Envelope geomEnvelope) {
+ Geometry geometry = layer.getGeometryEncoder().decodeGeometry(geomNode);
+ // The next line just calls the method that is causing exceptions on OSM data for testing
+ // TODO: Remove when OSM is working properly
+ geometry.getEnvelopeInternal();
+ return geometry.intersects(windowGeom);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/filter/SearchRecords.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchRecords.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/filter/SearchRecords.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/filter/SearchRecords.java
diff --git a/src/main/java/org/neo4j/gis/spatial/functions/SpatialFunctions.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/functions/SpatialFunctions.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/functions/SpatialFunctions.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/functions/SpatialFunctions.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedMonitor.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedMonitor.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedMonitor.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedMonitor.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedPointIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedPointIndex.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedPointIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/ExplicitIndexBackedPointIndex.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/IndexManager.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/IndexManager.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/IndexManager.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/IndexManager.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/LayerGeohashPointIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerGeohashPointIndex.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/LayerGeohashPointIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerGeohashPointIndex.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/LayerHilbertPointIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerHilbertPointIndex.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/LayerHilbertPointIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerHilbertPointIndex.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/LayerIndexReader.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerIndexReader.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/LayerIndexReader.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerIndexReader.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/LayerRTreeIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerRTreeIndex.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/LayerRTreeIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerRTreeIndex.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/LayerSpaceFillingCurvePointIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerSpaceFillingCurvePointIndex.java
similarity index 99%
rename from src/main/java/org/neo4j/gis/spatial/index/LayerSpaceFillingCurvePointIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerSpaceFillingCurvePointIndex.java
index 5af56fa7a..61fee3de4 100644
--- a/src/main/java/org/neo4j/gis/spatial/index/LayerSpaceFillingCurvePointIndex.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerSpaceFillingCurvePointIndex.java
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
import org.geotools.api.referencing.cs.CoordinateSystemAxis;
import org.locationtech.jts.geom.Geometry;
diff --git a/src/main/java/org/neo4j/gis/spatial/index/LayerTreeIndexReader.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerTreeIndexReader.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/LayerTreeIndexReader.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerTreeIndexReader.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/LayerZOrderPointIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerZOrderPointIndex.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/LayerZOrderPointIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/LayerZOrderPointIndex.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/PropertyEncodingNodeIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/PropertyEncodingNodeIndex.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/PropertyEncodingNodeIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/PropertyEncodingNodeIndex.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/SpatialIndexReader.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/SpatialIndexReader.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/SpatialIndexReader.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/SpatialIndexReader.java
diff --git a/src/main/java/org/neo4j/gis/spatial/index/SpatialIndexWriter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/index/SpatialIndexWriter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/index/SpatialIndexWriter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/index/SpatialIndexWriter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/indexfilter/CQLIndexReader.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/indexfilter/CQLIndexReader.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/indexfilter/CQLIndexReader.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/indexfilter/CQLIndexReader.java
diff --git a/src/main/java/org/neo4j/gis/spatial/indexfilter/DynamicIndexReader.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/indexfilter/DynamicIndexReader.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/indexfilter/DynamicIndexReader.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/indexfilter/DynamicIndexReader.java
diff --git a/src/main/java/org/neo4j/gis/spatial/indexfilter/LayerIndexReaderWrapper.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/indexfilter/LayerIndexReaderWrapper.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/indexfilter/LayerIndexReaderWrapper.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/indexfilter/LayerIndexReaderWrapper.java
diff --git a/src/main/java/org/neo4j/gis/spatial/osm/OSMDataset.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMDataset.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/osm/OSMDataset.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMDataset.java
diff --git a/src/main/java/org/neo4j/gis/spatial/osm/OSMGeometryEncoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMGeometryEncoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/osm/OSMGeometryEncoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMGeometryEncoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/osm/OSMImporter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMImporter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/osm/OSMImporter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMImporter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/osm/OSMLayer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMLayer.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/osm/OSMLayer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMLayer.java
diff --git a/src/main/java/org/neo4j/gis/spatial/osm/OSMLayerToShapefileExporter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMLayerToShapefileExporter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/osm/OSMLayerToShapefileExporter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMLayerToShapefileExporter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/osm/OSMRelation.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMRelation.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/osm/OSMRelation.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/osm/OSMRelation.java
diff --git a/src/main/java/org/neo4j/gis/spatial/osm/RoadDirection.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/osm/RoadDirection.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/osm/RoadDirection.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/osm/RoadDirection.java
diff --git a/src/main/java/org/neo4j/gis/spatial/package-info.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/package-info.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/package-info.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/package-info.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/AbstractExtractGeoPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractExtractGeoPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/AbstractExtractGeoPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractExtractGeoPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/AbstractFilterGeoPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractFilterGeoPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/AbstractFilterGeoPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractFilterGeoPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/AbstractGeoPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractGeoPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/AbstractGeoPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractGeoPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/AbstractGroupGeoPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractGroupGeoPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/AbstractGroupGeoPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/AbstractGroupGeoPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeFlow.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeFlow.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeFlow.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeFlow.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeline.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeline.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeline.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/GeoPipeline.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCQL.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCQL.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCQL.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCQL.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterContain.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterContain.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterContain.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterContain.java
index c2b5907c2..dea1681cc 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterContain.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterContain.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries that contain the given geometry
- */
-public class FilterContain extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final Envelope otherEnvelope;
-
- public FilterContain(Geometry other) {
- this.other = other;
- this.otherEnvelope = other.getEnvelopeInternal();
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- // check if every point of the other geometry is a point of this geometry,
- // and the interiors of the two geometries have at least one point in common
- return flow.getEnvelope().contains(otherEnvelope)
- && flow.getGeometry().contains(other);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries that contain the given geometry
+ */
+public class FilterContain extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final Envelope otherEnvelope;
+
+ public FilterContain(Geometry other) {
+ this.other = other;
+ this.otherEnvelope = other.getEnvelopeInternal();
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ // check if every point of the other geometry is a point of this geometry,
+ // and the interiors of the two geometries have at least one point in common
+ return flow.getEnvelope().contains(otherEnvelope)
+ && flow.getGeometry().contains(other);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCover.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCover.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCover.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCover.java
index 9a0a0e3d2..445e782ed 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCover.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCover.java
@@ -1,47 +1,47 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries that covers the given geometry
- */
-public class FilterCover extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final Envelope otherEnvelope;
-
- public FilterCover(Geometry other) {
- this.other = other;
- this.otherEnvelope = other.getEnvelopeInternal();
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- // check if every point of the other geometry is a point of this geometry
- return flow.getEnvelope().covers(otherEnvelope)
- && flow.getGeometry().covers(other);
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries that covers the given geometry
+ */
+public class FilterCover extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final Envelope otherEnvelope;
+
+ public FilterCover(Geometry other) {
+ this.other = other;
+ this.otherEnvelope = other.getEnvelopeInternal();
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ // check if every point of the other geometry is a point of this geometry
+ return flow.getEnvelope().covers(otherEnvelope)
+ && flow.getGeometry().covers(other);
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCoveredBy.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCoveredBy.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCoveredBy.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCoveredBy.java
index 25b4d0f78..aeb3da0c4 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCoveredBy.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCoveredBy.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries covered by the given geometry
- */
-public class FilterCoveredBy extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final Envelope otherEnvelope;
-
- public FilterCoveredBy(Geometry other) {
- this.other = other;
- this.otherEnvelope = other.getEnvelopeInternal();
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- // check if every point of this geometry is a point of the other geometry
- return otherEnvelope.covers(flow.getEnvelope())
- && flow.getGeometry().coveredBy(other);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries covered by the given geometry
+ */
+public class FilterCoveredBy extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final Envelope otherEnvelope;
+
+ public FilterCoveredBy(Geometry other) {
+ this.other = other;
+ this.otherEnvelope = other.getEnvelopeInternal();
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ // check if every point of this geometry is a point of the other geometry
+ return otherEnvelope.covers(flow.getEnvelope())
+ && flow.getGeometry().coveredBy(other);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCross.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCross.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCross.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCross.java
index 9a35e1421..050b1da97 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCross.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterCross.java
@@ -1,42 +1,42 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries that have some but not all interior points in common with the given geometry
- */
-public class FilterCross extends AbstractFilterGeoPipe {
-
- private final Geometry other;
-
- public FilterCross(Geometry other) {
- this.other = other;
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return flow.getGeometry().crosses(other);
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries that have some but not all interior points in common with the given geometry
+ */
+public class FilterCross extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+
+ public FilterCross(Geometry other) {
+ this.other = other;
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return flow.getGeometry().crosses(other);
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterDisjoint.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterDisjoint.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterDisjoint.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterDisjoint.java
index c357a1b30..618853ff7 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterDisjoint.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterDisjoint.java
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries that have no point in common with the given geometry
- */
-public class FilterDisjoint extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final Envelope otherEnvelope;
-
- public FilterDisjoint(Geometry other) {
- this.other = other;
- this.otherEnvelope = other.getEnvelopeInternal();
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return !flow.getEnvelope().intersects(otherEnvelope)
- || flow.getGeometry().disjoint(other);
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries that have no point in common with the given geometry
+ */
+public class FilterDisjoint extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final Envelope otherEnvelope;
+
+ public FilterDisjoint(Geometry other) {
+ this.other = other;
+ this.otherEnvelope = other.getEnvelopeInternal();
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return !flow.getEnvelope().intersects(otherEnvelope)
+ || flow.getGeometry().disjoint(other);
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEmpty.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEmpty.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEmpty.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEmpty.java
index c7f5b8cc4..db6ade846 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEmpty.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEmpty.java
@@ -1,36 +1,36 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find empty geometries.
- */
-public class FilterEmpty extends AbstractFilterGeoPipe {
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return flow.getGeometry().isEmpty();
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find empty geometries.
+ */
+public class FilterEmpty extends AbstractFilterGeoPipe {
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return flow.getGeometry().isEmpty();
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualExact.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualExact.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualExact.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualExact.java
index 52dea0068..eb9b23c37 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualExact.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualExact.java
@@ -1,54 +1,54 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries equal to the given geometry.
- *
- * This filter tests for structural equality of Geometry objects.
- * This means that they must have the same number of vertices, in the same locations, and in the same order.
- *
- * See GeoTools documentation .
- */
-public class FilterEqualExact extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final double tolerance;
-
- public FilterEqualExact(Geometry other) {
- this(other, 0);
- }
-
- public FilterEqualExact(Geometry other, double tolerance) {
- this.other = other;
- this.tolerance = tolerance;
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return other.equalsExact(flow.getGeometry(), tolerance);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries equal to the given geometry.
+ *
+ * This filter tests for structural equality of Geometry objects.
+ * This means that they must have the same number of vertices, in the same locations, and in the same order.
+ *
+ * See GeoTools documentation .
+ */
+public class FilterEqualExact extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final double tolerance;
+
+ public FilterEqualExact(Geometry other) {
+ this(other, 0);
+ }
+
+ public FilterEqualExact(Geometry other, double tolerance) {
+ this.other = other;
+ this.tolerance = tolerance;
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return other.equalsExact(flow.getGeometry(), tolerance);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualNorm.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualNorm.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualNorm.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualNorm.java
index eeec013bb..8f281bcc7 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualNorm.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualNorm.java
@@ -1,51 +1,51 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries equal to the given geometry (with the same number of vertices, in the same locations).
- *
- * See GeoTools documentation .
- */
-public class FilterEqualNorm extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final double tolerance;
-
- public FilterEqualNorm(Geometry other) {
- this(other, 0);
- }
-
- public FilterEqualNorm(Geometry other, double tolerance) {
- this.other = other.norm();
- this.tolerance = tolerance;
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- Geometry current = flow.getGeometry().norm();
- return other.equalsExact(current, tolerance);
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries equal to the given geometry (with the same number of vertices, in the same locations).
+ *
+ * See GeoTools documentation .
+ */
+public class FilterEqualNorm extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final double tolerance;
+
+ public FilterEqualNorm(Geometry other) {
+ this(other, 0);
+ }
+
+ public FilterEqualNorm(Geometry other, double tolerance) {
+ this.other = other.norm();
+ this.tolerance = tolerance;
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ Geometry current = flow.getGeometry().norm();
+ return other.equalsExact(current, tolerance);
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualTopo.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualTopo.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualTopo.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualTopo.java
index f69fc52bd..9d96da8a9 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualTopo.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterEqualTopo.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries equal to the given geometry.
- *
- * This filter tests for topological equality which is equivalent to drawing the two Geometry objects
- * and seeing if all of their component edges overlap. It is the most robust kind of comparison but also
- * the most computationally expensive.
- *
- * See GeoTools documentation .
- */
-public class FilterEqualTopo extends AbstractFilterGeoPipe {
-
- private final Geometry other;
-
- public FilterEqualTopo(Geometry other) {
- this.other = other;
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return other.equalsTopo(flow.getGeometry());
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries equal to the given geometry.
+ *
+ * This filter tests for topological equality which is equivalent to drawing the two Geometry objects
+ * and seeing if all of their component edges overlap. It is the most robust kind of comparison but also
+ * the most computationally expensive.
+ *
+ * See GeoTools documentation .
+ */
+public class FilterEqualTopo extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+
+ public FilterEqualTopo(Geometry other) {
+ this.other = other;
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return other.equalsTopo(flow.getGeometry());
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInRelation.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInRelation.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInRelation.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInRelation.java
index 471b44567..edb5321ff 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInRelation.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInRelation.java
@@ -1,50 +1,50 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Returned geometries have the specified relation with the given geometry
- */
-public class FilterInRelation extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final String intersectionPattern;
-
- /**
- * @param other geometry
- * @param intersectionPattern a 9-character string (for more information on the DE-9IM, see the OpenGIS Simple
- * Features Specification)
- */
- public FilterInRelation(Geometry other, String intersectionPattern) {
- this.other = other;
- this.intersectionPattern = intersectionPattern;
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return flow.getGeometry().relate(other, intersectionPattern);
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Returned geometries have the specified relation with the given geometry
+ */
+public class FilterInRelation extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final String intersectionPattern;
+
+ /**
+ * @param other geometry
+ * @param intersectionPattern a 9-character string (for more information on the DE-9IM, see the OpenGIS Simple
+ * Features Specification)
+ */
+ public FilterInRelation(Geometry other, String intersectionPattern) {
+ this.other = other;
+ this.intersectionPattern = intersectionPattern;
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return flow.getGeometry().relate(other, intersectionPattern);
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersect.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersect.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersect.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersect.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersectWindow.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersectWindow.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersectWindow.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterIntersectWindow.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInvalid.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInvalid.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInvalid.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInvalid.java
index 3c10ca803..c24d2de2d 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInvalid.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterInvalid.java
@@ -1,36 +1,36 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-/**
- * Find invalid geometries.
- */
-public class FilterInvalid extends AbstractFilterGeoPipe {
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return !flow.getGeometry().isValid();
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+/**
+ * Find invalid geometries.
+ */
+public class FilterInvalid extends AbstractFilterGeoPipe {
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return !flow.getGeometry().isValid();
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterOverlap.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterOverlap.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterOverlap.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterOverlap.java
index 9f16d4822..ae417a530 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterOverlap.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterOverlap.java
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries that overlap the given geometry
- */
-public class FilterOverlap extends AbstractFilterGeoPipe {
-
- private final Geometry other;
-
- public FilterOverlap(Geometry other) {
- this.other = other;
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- // check if the geometries have some but not all points in common,
- // they have the same dimension,
- // and the intersection of the interiors of the two geometries has
- // the same dimension as the geometries themselves
- return flow.getGeometry().overlaps(other);
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries that overlap the given geometry
+ */
+public class FilterOverlap extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+
+ public FilterOverlap(Geometry other) {
+ this.other = other;
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ // check if the geometries have some but not all points in common,
+ // they have the same dimension,
+ // and the intersection of the interiors of the two geometries has
+ // the same dimension as the geometries themselves
+ return flow.getGeometry().overlaps(other);
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterProperty.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterProperty.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterProperty.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterProperty.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNotNull.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNotNull.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNotNull.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNotNull.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNull.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNull.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNull.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterPropertyNull.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterTouch.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterTouch.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterTouch.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterTouch.java
index dacc01eae..c45ccad15 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterTouch.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterTouch.java
@@ -1,43 +1,43 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries that touch the given geometry.
- */
-public class FilterTouch extends AbstractFilterGeoPipe {
-
- private final Geometry other;
-
- public FilterTouch(Geometry other) {
- this.other = other;
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- // if the geometries have at least one point in common, but their interiors do not intersect
- return flow.getGeometry().touches(other);
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries that touch the given geometry.
+ */
+public class FilterTouch extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+
+ public FilterTouch(Geometry other) {
+ this.other = other;
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ // if the geometries have at least one point in common, but their interiors do not intersect
+ return flow.getGeometry().touches(other);
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterValid.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterValid.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterValid.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterValid.java
index 73b7e7441..f07826378 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterValid.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterValid.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find valid geometries.
- */
-public class FilterValid extends AbstractFilterGeoPipe {
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- return flow.getGeometry().isValid();
- }
-
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find valid geometries.
+ */
+public class FilterValid extends AbstractFilterGeoPipe {
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ return flow.getGeometry().isValid();
+ }
+
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterWithin.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterWithin.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterWithin.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterWithin.java
index dc1d9ad14..75ed60ed0 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterWithin.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/filtering/FilterWithin.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.filtering;
-
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Find geometries that are within the given geometry.
- */
-public class FilterWithin extends AbstractFilterGeoPipe {
-
- private final Geometry other;
- private final Envelope otherEnvelope;
-
- public FilterWithin(Geometry other) {
- this.other = other;
- this.otherEnvelope = other.getEnvelopeInternal();
- }
-
- @Override
- protected boolean validate(GeoPipeFlow flow) {
- // check if every point of this geometry is a point of the other geometry,
- // and the interiors of the two geometries have at least one point in common
- return otherEnvelope.contains(flow.getEnvelope())
- && flow.getGeometry().within(other);
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.filtering;
+
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.neo4j.gis.spatial.pipes.AbstractFilterGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Find geometries that are within the given geometry.
+ */
+public class FilterWithin extends AbstractFilterGeoPipe {
+
+ private final Geometry other;
+ private final Envelope otherEnvelope;
+
+ public FilterWithin(Geometry other) {
+ this.other = other;
+ this.otherEnvelope = other.getEnvelopeInternal();
+ }
+
+ @Override
+ protected boolean validate(GeoPipeFlow flow) {
+ // check if every point of this geometry is a point of the other geometry,
+ // and the interiors of the two geometries have at least one point in common
+ return otherEnvelope.contains(flow.getEnvelope())
+ && flow.getGeometry().within(other);
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/impl/AbstractPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/AbstractPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/impl/AbstractPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/AbstractPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/impl/FilterPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/FilterPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/impl/FilterPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/FilterPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/impl/IdentityPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/IdentityPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/impl/IdentityPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/IdentityPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/impl/LastElementIterator.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/LastElementIterator.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/impl/LastElementIterator.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/LastElementIterator.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipeline.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipeline.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipeline.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/Pipeline.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/impl/RangeFilterPipe.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/RangeFilterPipe.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/impl/RangeFilterPipe.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/impl/RangeFilterPipe.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/osm/OSMGeoPipeline.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/osm/OSMGeoPipeline.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/osm/OSMGeoPipeline.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/osm/OSMGeoPipeline.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/osm/filtering/FilterOSMAttributes.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/osm/filtering/FilterOSMAttributes.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/osm/filtering/FilterOSMAttributes.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/osm/filtering/FilterOSMAttributes.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/osm/processing/ExtractOSMPoints.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/osm/processing/ExtractOSMPoints.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/osm/processing/ExtractOSMPoints.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/osm/processing/ExtractOSMPoints.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/ApplyAffineTransformation.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ApplyAffineTransformation.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/ApplyAffineTransformation.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ApplyAffineTransformation.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Area.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Area.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Area.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Area.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Boundary.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Boundary.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Boundary.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Boundary.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Buffer.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Buffer.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Buffer.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Buffer.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Centroid.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Centroid.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Centroid.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Centroid.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/ConvexHull.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ConvexHull.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/ConvexHull.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ConvexHull.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/CopyDatabaseRecordProperties.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/CopyDatabaseRecordProperties.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/CopyDatabaseRecordProperties.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/CopyDatabaseRecordProperties.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Densify.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Densify.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Densify.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Densify.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/DensityIslands.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/DensityIslands.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/DensityIslands.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/DensityIslands.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Difference.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Difference.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Difference.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Difference.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Dimension.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Dimension.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Dimension.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Dimension.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Distance.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Distance.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Distance.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Distance.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/EndPoint.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/EndPoint.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/EndPoint.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/EndPoint.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Envelope.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Envelope.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Envelope.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Envelope.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractGeometries.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractGeometries.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractGeometries.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractGeometries.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractPoints.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractPoints.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractPoints.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/ExtractPoints.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/GML.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/GML.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/GML.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/GML.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/GeoJSON.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/GeoJSON.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/GeoJSON.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/GeoJSON.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/GeometryType.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/GeometryType.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/GeometryType.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/GeometryType.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/InteriorPoint.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/InteriorPoint.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/InteriorPoint.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/InteriorPoint.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/IntersectAll.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/IntersectAll.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/IntersectAll.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/IntersectAll.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Intersection.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Intersection.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Intersection.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Intersection.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/KeyholeMarkupLanguage.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/KeyholeMarkupLanguage.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/KeyholeMarkupLanguage.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/KeyholeMarkupLanguage.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Length.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Length.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Length.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Length.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Max.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Max.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Max.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Max.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Min.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Min.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Min.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Min.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/NumGeometries.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/NumGeometries.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/NumGeometries.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/NumGeometries.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/NumPoints.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/NumPoints.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/NumPoints.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/NumPoints.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicDistance.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicDistance.java
similarity index 97%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicDistance.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicDistance.java
index 6e7779f1c..e5542c6f2 100644
--- a/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicDistance.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicDistance.java
@@ -1,98 +1,98 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.pipes.processing;
-
-import org.locationtech.jts.geom.Coordinate;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.geom.Point;
-import org.locationtech.jts.operation.distance.DistanceOp;
-import org.neo4j.gis.spatial.pipes.AbstractGeoPipe;
-import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
-
-
-/**
- * Calculates distance between the given geometry and item geometry for each item in the pipeline.
- * This pipe assume Layer contains geometries with Latitude / Longitude coordinates in degrees.
- *
- * Algorithm reference
- */
-public class OrthodromicDistance extends AbstractGeoPipe {
-
- private final Coordinate reference;
- public static final double earthRadiusInKm = 6371;
- public static final String DISTANCE = "OrthodromicDistance";
-
- public OrthodromicDistance(Coordinate reference) {
- this(reference, OrthodromicDistance.DISTANCE);
- }
-
- /**
- * @param resultPropertyName property name to use for geometry output
- */
- public OrthodromicDistance(Coordinate reference, String resultPropertyName) {
- super(resultPropertyName);
- this.reference = reference;
- }
-
- @Override
- protected GeoPipeFlow process(GeoPipeFlow flow) {
- double distanceInKm = calculateDistanceToGeometry(reference, flow.getGeometry());
- setProperty(flow, distanceInKm);
- return flow;
- }
-
- public static double calculateDistanceToGeometry(Coordinate reference, Geometry geometry) {
- if (geometry instanceof Point point) {
- return calculateDistance(reference, point.getCoordinate());
- }
- Geometry referencePoint = geometry.getFactory().createPoint(reference);
- DistanceOp ops = new DistanceOp(referencePoint, geometry);
- Coordinate[] nearest = ops.nearestPoints();
- assert nearest.length == 2;
- return calculateDistance(nearest[0], nearest[1]);
- }
-
- public static Envelope suggestSearchWindow(Coordinate reference, double maxDistanceInKm) {
- double lat = reference.y;
- double lon = reference.x;
-
- double degrees = Math.toDegrees(maxDistanceInKm / earthRadiusInKm);
-
- // first-cut bounding box (in degrees)
- double maxLat = lat + degrees;
- double minLat = lat - degrees;
-
- degrees = Math.toDegrees(maxDistanceInKm / earthRadiusInKm / Math.cos(Math.toRadians(lat)));
- // compensate for degrees longitude getting smaller with increasing latitude
- double maxLon = lon + degrees;
- double minLon = lon - degrees;
- return new Envelope(minLon, maxLon, minLat, maxLat);
- }
-
- public static double calculateDistance(Coordinate reference, Coordinate point) {
- // TODO use org.geotools.referencing.GeodeticCalculator?
- // d = acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1)) * R
- return Math.acos(Math.min(Math.sin(Math.toRadians(reference.y)) * Math.sin(Math.toRadians(point.y))
- + Math.cos(Math.toRadians(reference.y)) * Math.cos(Math.toRadians(point.y))
- * Math.cos(Math.toRadians(point.x) - Math.toRadians(reference.x)), 1.0))
- * earthRadiusInKm;
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.pipes.processing;
+
+import org.locationtech.jts.geom.Coordinate;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.Point;
+import org.locationtech.jts.operation.distance.DistanceOp;
+import org.neo4j.gis.spatial.pipes.AbstractGeoPipe;
+import org.neo4j.gis.spatial.pipes.GeoPipeFlow;
+
+
+/**
+ * Calculates distance between the given geometry and item geometry for each item in the pipeline.
+ * This pipe assume Layer contains geometries with Latitude / Longitude coordinates in degrees.
+ *
+ * Algorithm reference
+ */
+public class OrthodromicDistance extends AbstractGeoPipe {
+
+ private final Coordinate reference;
+ public static final double earthRadiusInKm = 6371;
+ public static final String DISTANCE = "OrthodromicDistance";
+
+ public OrthodromicDistance(Coordinate reference) {
+ this(reference, OrthodromicDistance.DISTANCE);
+ }
+
+ /**
+ * @param resultPropertyName property name to use for geometry output
+ */
+ public OrthodromicDistance(Coordinate reference, String resultPropertyName) {
+ super(resultPropertyName);
+ this.reference = reference;
+ }
+
+ @Override
+ protected GeoPipeFlow process(GeoPipeFlow flow) {
+ double distanceInKm = calculateDistanceToGeometry(reference, flow.getGeometry());
+ setProperty(flow, distanceInKm);
+ return flow;
+ }
+
+ public static double calculateDistanceToGeometry(Coordinate reference, Geometry geometry) {
+ if (geometry instanceof Point point) {
+ return calculateDistance(reference, point.getCoordinate());
+ }
+ Geometry referencePoint = geometry.getFactory().createPoint(reference);
+ DistanceOp ops = new DistanceOp(referencePoint, geometry);
+ Coordinate[] nearest = ops.nearestPoints();
+ assert nearest.length == 2;
+ return calculateDistance(nearest[0], nearest[1]);
+ }
+
+ public static Envelope suggestSearchWindow(Coordinate reference, double maxDistanceInKm) {
+ double lat = reference.y;
+ double lon = reference.x;
+
+ double degrees = Math.toDegrees(maxDistanceInKm / earthRadiusInKm);
+
+ // first-cut bounding box (in degrees)
+ double maxLat = lat + degrees;
+ double minLat = lat - degrees;
+
+ degrees = Math.toDegrees(maxDistanceInKm / earthRadiusInKm / Math.cos(Math.toRadians(lat)));
+ // compensate for degrees longitude getting smaller with increasing latitude
+ double maxLon = lon + degrees;
+ double minLon = lon - degrees;
+ return new Envelope(minLon, maxLon, minLat, maxLat);
+ }
+
+ public static double calculateDistance(Coordinate reference, Coordinate point) {
+ // TODO use org.geotools.referencing.GeodeticCalculator?
+ // d = acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1)) * R
+ return Math.acos(Math.min(Math.sin(Math.toRadians(reference.y)) * Math.sin(Math.toRadians(point.y))
+ + Math.cos(Math.toRadians(reference.y)) * Math.cos(Math.toRadians(point.y))
+ * Math.cos(Math.toRadians(point.x) - Math.toRadians(reference.x)), 1.0))
+ * earthRadiusInKm;
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicLength.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicLength.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicLength.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/OrthodromicLength.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyPreservingTopology.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyPreservingTopology.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyPreservingTopology.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyPreservingTopology.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyWithDouglasPeucker.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyWithDouglasPeucker.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyWithDouglasPeucker.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/SimplifyWithDouglasPeucker.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Sort.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Sort.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Sort.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Sort.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/StartPoint.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/StartPoint.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/StartPoint.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/StartPoint.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/SymDifference.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/SymDifference.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/SymDifference.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/SymDifference.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/Union.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Union.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/Union.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/Union.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/UnionAll.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/UnionAll.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/UnionAll.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/UnionAll.java
diff --git a/src/main/java/org/neo4j/gis/spatial/pipes/processing/WellKnownText.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/WellKnownText.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/pipes/processing/WellKnownText.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/pipes/processing/WellKnownText.java
diff --git a/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java
diff --git a/src/main/java/org/neo4j/gis/spatial/process/SpatialProcess.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/process/SpatialProcess.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/process/SpatialProcess.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/process/SpatialProcess.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/EmptyMonitor.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/EmptyMonitor.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/EmptyMonitor.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/EmptyMonitor.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/Envelope.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/Envelope.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/Envelope.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/Envelope.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoder.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoder.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoder.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoder.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoderFromDoubleArray.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoderFromDoubleArray.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoderFromDoubleArray.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/EnvelopeDecoderFromDoubleArray.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/Listener.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/Listener.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/Listener.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/Listener.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/NullListener.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/NullListener.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/NullListener.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/NullListener.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/ProgressLoggingListener.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/ProgressLoggingListener.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/ProgressLoggingListener.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/ProgressLoggingListener.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/RTreeImageExporter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeImageExporter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/RTreeImageExporter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeImageExporter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/RTreeIndex.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeIndex.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/RTreeIndex.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeIndex.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/RTreeMonitor.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeMonitor.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/RTreeMonitor.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeMonitor.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/RTreeRelationshipTypes.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeRelationshipTypes.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/RTreeRelationshipTypes.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/RTreeRelationshipTypes.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexRecordCounter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexRecordCounter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexRecordCounter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexRecordCounter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexVisitor.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexVisitor.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexVisitor.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/SpatialIndexVisitor.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/TreeMonitor.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/TreeMonitor.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/TreeMonitor.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/TreeMonitor.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/filter/AbstractSearchEnvelopeIntersection.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/AbstractSearchEnvelopeIntersection.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/filter/AbstractSearchEnvelopeIntersection.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/AbstractSearchEnvelopeIntersection.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchAll.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchAll.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchAll.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchAll.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchCoveredByEnvelope.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchCoveredByEnvelope.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchCoveredByEnvelope.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchCoveredByEnvelope.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchEqualEnvelopes.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchEqualEnvelopes.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchEqualEnvelopes.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchEqualEnvelopes.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchFilter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchFilter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchFilter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchFilter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchResults.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchResults.java
similarity index 96%
rename from src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchResults.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchResults.java
index 45e1bb83d..958ef98df 100644
--- a/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchResults.java
+++ b/server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchResults.java
@@ -1,51 +1,51 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial.rtree.filter;
-
-import java.util.Iterator;
-import javax.annotation.Nonnull;
-import org.neo4j.graphdb.Node;
-
-public class SearchResults implements Iterable {
-
- private final Iterable traverser;
- private int count = -1;
-
- public SearchResults(Iterable traverser) {
- this.traverser = traverser;
- }
-
- @Override
- @Nonnull
- public Iterator iterator() {
- return traverser.iterator();
- }
-
- public int count() {
- if (count < 0) {
- count = 0;
- for (@SuppressWarnings("unused")
- Node node : this) {
- count++;
- }
- }
- return count;
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial.rtree.filter;
+
+import java.util.Iterator;
+import javax.annotation.Nonnull;
+import org.neo4j.graphdb.Node;
+
+public class SearchResults implements Iterable {
+
+ private final Iterable traverser;
+ private int count = -1;
+
+ public SearchResults(Iterable traverser) {
+ this.traverser = traverser;
+ }
+
+ @Override
+ @Nonnull
+ public Iterator iterator() {
+ return traverser.iterator();
+ }
+
+ public int count() {
+ if (count < 0) {
+ count = 0;
+ for (@SuppressWarnings("unused")
+ Node node : this) {
+ count++;
+ }
+ }
+ return count;
+ }
+}
diff --git a/src/main/java/org/neo4j/gis/spatial/utilities/GeoJsonUtils.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/GeoJsonUtils.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/utilities/GeoJsonUtils.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/GeoJsonUtils.java
diff --git a/src/main/java/org/neo4j/gis/spatial/utilities/GeotoolsAdapter.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/GeotoolsAdapter.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/utilities/GeotoolsAdapter.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/GeotoolsAdapter.java
diff --git a/src/main/java/org/neo4j/gis/spatial/utilities/LayerUtilities.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/LayerUtilities.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/utilities/LayerUtilities.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/LayerUtilities.java
diff --git a/src/main/java/org/neo4j/gis/spatial/utilities/ReferenceNodes.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/ReferenceNodes.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/utilities/ReferenceNodes.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/ReferenceNodes.java
diff --git a/src/main/java/org/neo4j/gis/spatial/utilities/RelationshipTraversal.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/RelationshipTraversal.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/utilities/RelationshipTraversal.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/RelationshipTraversal.java
diff --git a/src/main/java/org/neo4j/gis/spatial/utilities/SpatialApiBase.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/SpatialApiBase.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/utilities/SpatialApiBase.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/SpatialApiBase.java
diff --git a/src/main/java/org/neo4j/gis/spatial/utilities/TraverserFactory.java b/server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/TraverserFactory.java
similarity index 100%
rename from src/main/java/org/neo4j/gis/spatial/utilities/TraverserFactory.java
rename to server-plugin/src/main/java/org/neo4j/gis/spatial/utilities/TraverserFactory.java
diff --git a/src/main/python/test_mapnik.py b/server-plugin/src/main/python/test_mapnik.py
similarity index 100%
rename from src/main/python/test_mapnik.py
rename to server-plugin/src/main/python/test_mapnik.py
diff --git a/src/main/resources/META-INF/services/org.geotools.data.DataStoreFactorySpi b/server-plugin/src/main/resources/META-INF/services/org.geotools.data.DataStoreFactorySpi
similarity index 100%
rename from src/main/resources/META-INF/services/org.geotools.data.DataStoreFactorySpi
rename to server-plugin/src/main/resources/META-INF/services/org.geotools.data.DataStoreFactorySpi
diff --git a/src/main/resources/META-INF/services/org.geotools.process.ProcessFactory b/server-plugin/src/main/resources/META-INF/services/org.geotools.process.ProcessFactory
similarity index 100%
rename from src/main/resources/META-INF/services/org.geotools.process.ProcessFactory
rename to server-plugin/src/main/resources/META-INF/services/org.geotools.process.ProcessFactory
diff --git a/src/main/resources/NEO4J-SPATIAL.txt b/server-plugin/src/main/resources/NEO4J-SPATIAL.txt
similarity index 100%
rename from src/main/resources/NEO4J-SPATIAL.txt
rename to server-plugin/src/main/resources/NEO4J-SPATIAL.txt
diff --git a/src/main/resources/sld/osm/highway-primary.rb b/server-plugin/src/main/resources/sld/osm/highway-primary.rb
similarity index 100%
rename from src/main/resources/sld/osm/highway-primary.rb
rename to server-plugin/src/main/resources/sld/osm/highway-primary.rb
diff --git a/src/main/resources/sld/osm/highway-primary.sld b/server-plugin/src/main/resources/sld/osm/highway-primary.sld
similarity index 100%
rename from src/main/resources/sld/osm/highway-primary.sld
rename to server-plugin/src/main/resources/sld/osm/highway-primary.sld
diff --git a/src/main/resources/sld/osm/highway-residential.rb b/server-plugin/src/main/resources/sld/osm/highway-residential.rb
similarity index 100%
rename from src/main/resources/sld/osm/highway-residential.rb
rename to server-plugin/src/main/resources/sld/osm/highway-residential.rb
diff --git a/src/main/resources/sld/osm/highway-residential.sld b/server-plugin/src/main/resources/sld/osm/highway-residential.sld
similarity index 100%
rename from src/main/resources/sld/osm/highway-residential.sld
rename to server-plugin/src/main/resources/sld/osm/highway-residential.sld
diff --git a/src/main/resources/sld/osm/highway-secondary.rb b/server-plugin/src/main/resources/sld/osm/highway-secondary.rb
similarity index 100%
rename from src/main/resources/sld/osm/highway-secondary.rb
rename to server-plugin/src/main/resources/sld/osm/highway-secondary.rb
diff --git a/src/main/resources/sld/osm/highway-secondary.sld b/server-plugin/src/main/resources/sld/osm/highway-secondary.sld
similarity index 100%
rename from src/main/resources/sld/osm/highway-secondary.sld
rename to server-plugin/src/main/resources/sld/osm/highway-secondary.sld
diff --git a/src/main/resources/sld/osm/highway-tertiary.rb b/server-plugin/src/main/resources/sld/osm/highway-tertiary.rb
similarity index 100%
rename from src/main/resources/sld/osm/highway-tertiary.rb
rename to server-plugin/src/main/resources/sld/osm/highway-tertiary.rb
diff --git a/src/main/resources/sld/osm/highway-tertiary.sld b/server-plugin/src/main/resources/sld/osm/highway-tertiary.sld
similarity index 100%
rename from src/main/resources/sld/osm/highway-tertiary.sld
rename to server-plugin/src/main/resources/sld/osm/highway-tertiary.sld
diff --git a/src/main/resources/sld/osm/highway.rb b/server-plugin/src/main/resources/sld/osm/highway.rb
similarity index 100%
rename from src/main/resources/sld/osm/highway.rb
rename to server-plugin/src/main/resources/sld/osm/highway.rb
diff --git a/src/main/resources/sld/osm/highway.sld b/server-plugin/src/main/resources/sld/osm/highway.sld
similarity index 100%
rename from src/main/resources/sld/osm/highway.sld
rename to server-plugin/src/main/resources/sld/osm/highway.sld
diff --git a/src/main/resources/sld/osm/osm.rb b/server-plugin/src/main/resources/sld/osm/osm.rb
similarity index 100%
rename from src/main/resources/sld/osm/osm.rb
rename to server-plugin/src/main/resources/sld/osm/osm.rb
diff --git a/src/main/resources/sld/osm/osm.sld b/server-plugin/src/main/resources/sld/osm/osm.sld
similarity index 100%
rename from src/main/resources/sld/osm/osm.sld
rename to server-plugin/src/main/resources/sld/osm/osm.sld
diff --git a/src/main/resources/text-maker.rb b/server-plugin/src/main/resources/text-maker.rb
similarity index 100%
rename from src/main/resources/text-maker.rb
rename to server-plugin/src/main/resources/text-maker.rb
diff --git a/src/test/java/org/neo4j/doc/domain/examples/Example.java b/server-plugin/src/test/java/org/neo4j/doc/domain/examples/Example.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/domain/examples/Example.java
rename to server-plugin/src/test/java/org/neo4j/doc/domain/examples/Example.java
diff --git a/src/test/java/org/neo4j/doc/domain/examples/ExampleCypher.java b/server-plugin/src/test/java/org/neo4j/doc/domain/examples/ExampleCypher.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/domain/examples/ExampleCypher.java
rename to server-plugin/src/test/java/org/neo4j/doc/domain/examples/ExampleCypher.java
diff --git a/src/test/java/org/neo4j/doc/domain/examples/Examples.java b/server-plugin/src/test/java/org/neo4j/doc/domain/examples/Examples.java
similarity index 95%
rename from src/test/java/org/neo4j/doc/domain/examples/Examples.java
rename to server-plugin/src/test/java/org/neo4j/doc/domain/examples/Examples.java
index 9e6855819..32d3d0afa 100644
--- a/src/test/java/org/neo4j/doc/domain/examples/Examples.java
+++ b/server-plugin/src/test/java/org/neo4j/doc/domain/examples/Examples.java
@@ -40,7 +40,7 @@ public void writeExamples() throws IOException {
var index = fqname.lastIndexOf(".");
var namespace = index < 0 ? "" : fqname.substring(0, index);
- Path path = Paths.get("docs/docs/modules/ROOT/partials/generated/api", namespace,
+ Path path = Paths.get("../docs/docs/modules/ROOT/partials/generated/api", namespace,
fqname + "-examples.adoc");
Files.createDirectories(path.getParent());
diff --git a/src/test/java/org/neo4j/doc/domain/examples/ExamplesRepository.java b/server-plugin/src/test/java/org/neo4j/doc/domain/examples/ExamplesRepository.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/domain/examples/ExamplesRepository.java
rename to server-plugin/src/test/java/org/neo4j/doc/domain/examples/ExamplesRepository.java
diff --git a/src/test/java/org/neo4j/doc/domain/examples/Mapper.java b/server-plugin/src/test/java/org/neo4j/doc/domain/examples/Mapper.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/domain/examples/Mapper.java
rename to server-plugin/src/test/java/org/neo4j/doc/domain/examples/Mapper.java
diff --git a/src/test/java/org/neo4j/doc/tools/AsciiDocGenerator.java b/server-plugin/src/test/java/org/neo4j/doc/tools/AsciiDocGenerator.java
similarity index 97%
rename from src/test/java/org/neo4j/doc/tools/AsciiDocGenerator.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/AsciiDocGenerator.java
index 55f738bde..9367398b5 100644
--- a/src/test/java/org/neo4j/doc/tools/AsciiDocGenerator.java
+++ b/server-plugin/src/test/java/org/neo4j/doc/tools/AsciiDocGenerator.java
@@ -177,10 +177,10 @@ public void addTestSourceSnippets(Class> source, String... tagNames) {
private static String sourceSnippet(String tagName, Class> source) {
// ensure symlink is created
- Path target = new File("docs/docs/modules/ROOT/examples/" + source.getSimpleName() + ".java").toPath();
+ Path target = new File("../docs/docs/modules/ROOT/examples/" + source.getSimpleName() + ".java").toPath().toAbsolutePath().normalize();
if (!Files.exists(target)) {
String sourcePath = "src/test/java/" + getPath(source);
- Path relPath = target.getParent().relativize(new File(sourcePath).toPath());
+ Path relPath = target.getParent().relativize(new File(sourcePath).toPath().toAbsolutePath());
try {
Files.createSymbolicLink(target, relPath);
} catch (IOException e) {
diff --git a/src/test/java/org/neo4j/doc/tools/DocNode.java b/server-plugin/src/test/java/org/neo4j/doc/tools/DocNode.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/tools/DocNode.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/DocNode.java
diff --git a/src/test/java/org/neo4j/doc/tools/DocumentationData.java b/server-plugin/src/test/java/org/neo4j/doc/tools/DocumentationData.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/tools/DocumentationData.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/DocumentationData.java
diff --git a/src/test/java/org/neo4j/doc/tools/GraphVizConfig.java b/server-plugin/src/test/java/org/neo4j/doc/tools/GraphVizConfig.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/tools/GraphVizConfig.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/GraphVizConfig.java
diff --git a/src/test/java/org/neo4j/doc/tools/JSONPrettifier.java b/server-plugin/src/test/java/org/neo4j/doc/tools/JSONPrettifier.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/tools/JSONPrettifier.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/JSONPrettifier.java
diff --git a/src/test/java/org/neo4j/doc/tools/JavaTestDocsGenerator.java b/server-plugin/src/test/java/org/neo4j/doc/tools/JavaTestDocsGenerator.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/tools/JavaTestDocsGenerator.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/JavaTestDocsGenerator.java
diff --git a/src/test/java/org/neo4j/doc/tools/NodeCypherSerializer.java b/server-plugin/src/test/java/org/neo4j/doc/tools/NodeCypherSerializer.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/tools/NodeCypherSerializer.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/NodeCypherSerializer.java
diff --git a/src/test/java/org/neo4j/doc/tools/SpatialGraphVizHelper.java b/server-plugin/src/test/java/org/neo4j/doc/tools/SpatialGraphVizHelper.java
similarity index 100%
rename from src/test/java/org/neo4j/doc/tools/SpatialGraphVizHelper.java
rename to server-plugin/src/test/java/org/neo4j/doc/tools/SpatialGraphVizHelper.java
diff --git a/src/test/java/org/neo4j/gis/spatial/AbstractApiTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/AbstractApiTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/AbstractApiTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/AbstractApiTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/AbstractJavaDocTestBase.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/AbstractJavaDocTestBase.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/AbstractJavaDocTestBase.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/AbstractJavaDocTestBase.java
diff --git a/src/test/java/org/neo4j/gis/spatial/DocGeneratorTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/DocGeneratorTest.java
similarity index 95%
rename from src/test/java/org/neo4j/gis/spatial/DocGeneratorTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/DocGeneratorTest.java
index 7ab266a3d..f396f5f8b 100644
--- a/src/test/java/org/neo4j/gis/spatial/DocGeneratorTest.java
+++ b/server-plugin/src/test/java/org/neo4j/gis/spatial/DocGeneratorTest.java
@@ -104,7 +104,7 @@ public void add(DescribedSignature sig) {
}
public void writeDoc() throws IOException {
- Path file = Path.of("docs/docs/modules/ROOT/partials/generated/api/index.adoc");
+ Path file = Path.of("../docs/docs/modules/ROOT/partials/generated/api/index.adoc");
Files.createDirectories(file.getParent());
try (BufferedWriter writer = Files.newBufferedWriter(file)) {
writer.append(GENERATED_COMMENT);
@@ -113,7 +113,7 @@ public void writeDoc() throws IOException {
}
public void writeNav() throws IOException {
- Path file = Path.of("docs/docs/modules/ROOT/partials/generated/api-nav.adoc");
+ Path file = Path.of("../docs/docs/modules/ROOT/partials/generated/api-nav.adoc");
Files.createDirectories(file.getParent());
try (BufferedWriter writer = Files.newBufferedWriter(file)) {
writer.append(GENERATED_COMMENT);
@@ -133,11 +133,11 @@ public void writeSingleDocs() throws IOException {
private void writeSingleDoc(DescribedSignature entry) throws IOException {
String fqname = entry.name().toString();
- Path customizedFile = Path.of("docs/docs/modules/ROOT/pages/api", namespace, fqname + ".adoc");
+ Path customizedFile = Path.of("../docs/docs/modules/ROOT/pages/api", namespace, fqname + ".adoc");
if (!Files.exists(customizedFile)) {
Files.createDirectories(customizedFile.getParent());
String commented = Files.exists(
- Path.of("docs/docs/modules/ROOT/partials/generated/api", namespace, fqname + "-examples.adoc"))
+ Path.of("../docs/docs/modules/ROOT/partials/generated/api", namespace, fqname + "-examples.adoc"))
? "" : "// ";
Files.writeString(customizedFile,
"include::partial$generated/api/" + namespace + "/" + fqname + ".adoc[]\n\n"
@@ -147,7 +147,7 @@ private void writeSingleDoc(DescribedSignature entry) throws IOException {
+ "-examples.adoc[]\n");
}
- Path file = Path.of("docs/docs/modules/ROOT/partials/generated/api", namespace, fqname + ".adoc");
+ Path file = Path.of("../docs/docs/modules/ROOT/partials/generated/api", namespace, fqname + ".adoc");
Files.createDirectories(file.getParent());
List inputs;
diff --git a/src/test/java/org/neo4j/gis/spatial/FakeIndex.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/FakeIndex.java
similarity index 96%
rename from src/test/java/org/neo4j/gis/spatial/FakeIndex.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/FakeIndex.java
index 8a77408f0..6673508fa 100644
--- a/src/test/java/org/neo4j/gis/spatial/FakeIndex.java
+++ b/server-plugin/src/test/java/org/neo4j/gis/spatial/FakeIndex.java
@@ -1,191 +1,191 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.neo4j.gis.spatial.filter.SearchRecords;
-import org.neo4j.gis.spatial.index.IndexManager;
-import org.neo4j.gis.spatial.index.LayerIndexReader;
-import org.neo4j.gis.spatial.rtree.Envelope;
-import org.neo4j.gis.spatial.rtree.EnvelopeDecoder;
-import org.neo4j.gis.spatial.rtree.TreeMonitor;
-import org.neo4j.gis.spatial.rtree.filter.SearchFilter;
-import org.neo4j.gis.spatial.rtree.filter.SearchResults;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-
-/**
- * An in-memory index used for comparative benchmarking and testing
- */
-public class FakeIndex implements LayerIndexReader, Constants {
-
- public FakeIndex(Layer layer, IndexManager indexManager) {
- init(null, indexManager, layer);
- }
-
- @Override
- public void init(Transaction ignored, IndexManager indexManager, Layer layer) {
- this.layer = layer;
- }
-
- @Override
- public Layer getLayer() {
- return layer;
- }
-
- @Override
- public int count(Transaction tx) {
- int count = 0;
-
- // @TODO: Consider adding a count method to Layer or SpatialDataset to allow for
- // optimization of this if this kind of code gets used elsewhere
- for (@SuppressWarnings("unused") Node node : layer.getDataset().getAllGeometryNodes(tx)) {
- count++;
- }
-
- return count;
- }
-
- @Override
- public boolean isEmpty(Transaction tx) {
- return count(tx) == 0;
- }
-
- @Override
- public Envelope getBoundingBox(Transaction tx) {
- Envelope bbox = null;
-
- GeometryEncoder geomEncoder = layer.getGeometryEncoder();
- for (Node node : layer.getDataset().getAllGeometryNodes(tx)) {
- if (bbox == null) {
- bbox = geomEncoder.decodeEnvelope(node);
- } else {
- bbox.expandToInclude(geomEncoder.decodeEnvelope(node));
- }
- }
-
- return bbox;
- }
-
- public SpatialDatabaseRecord get(Transaction tx, String geomNodeId) {
- return new SpatialDatabaseRecord(layer, tx.getNodeByElementId(geomNodeId));
- }
-
- public List get(Transaction tx, Set geomNodeIds) {
- List results = new ArrayList<>();
-
- for (String geomNodeId : geomNodeIds) {
- results.add(get(tx, geomNodeId));
- }
-
- return results;
- }
-
- @Override
- public Iterable getAllIndexedNodes(Transaction tx) {
- return layer.getIndex().getAllIndexedNodes(tx);
- }
-
- @Override
- public EnvelopeDecoder getEnvelopeDecoder() {
- return layer.getGeometryEncoder();
- }
-
-
- @Override
- public boolean isNodeIndexed(Transaction tx, String nodeId) {
- // TODO
- return true;
- }
-
- // Attributes
-
- private Layer layer;
-
- private class NodeFilter implements Iterable, Iterator {
-
- private final Transaction tx;
- private final SearchFilter filter;
- private Node nextNode;
- private final Iterator nodes;
-
- NodeFilter(Transaction tx, SearchFilter filter, Iterable nodes) {
- this.tx = tx;
- this.filter = filter;
- this.nodes = nodes.iterator();
- nextNode = getNextNode();
- }
-
- @Override
- public Iterator iterator() {
- return this;
- }
-
- @Override
- public boolean hasNext() {
- return nextNode != null;
- }
-
- @Override
- public Node next() {
- Node currentNode = nextNode;
- nextNode = getNextNode();
- return currentNode;
- }
-
- private Node getNextNode() {
- Node nn = null;
- while (nodes.hasNext()) {
- Node node = nodes.next();
- if (filter.geometryMatches(tx, node)) {
- nn = node;
- break;
- }
- }
- return nn;
- }
-
- @Override
- public void remove() {
- }
- }
-
- @Override
- public SearchResults searchIndex(Transaction tx, SearchFilter filter) {
- return new SearchResults(new NodeFilter(tx, filter, layer.getDataset().getAllGeometryNodes(tx)));
- }
-
- @Override
- public void addMonitor(TreeMonitor monitor) {
- }
-
- @Override
- public void configure(Map config) {
- }
-
- @Override
- public SearchRecords search(Transaction tx, SearchFilter filter) {
- return new SearchRecords(layer, searchIndex(tx, filter));
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.neo4j.gis.spatial.filter.SearchRecords;
+import org.neo4j.gis.spatial.index.IndexManager;
+import org.neo4j.gis.spatial.index.LayerIndexReader;
+import org.neo4j.gis.spatial.rtree.Envelope;
+import org.neo4j.gis.spatial.rtree.EnvelopeDecoder;
+import org.neo4j.gis.spatial.rtree.TreeMonitor;
+import org.neo4j.gis.spatial.rtree.filter.SearchFilter;
+import org.neo4j.gis.spatial.rtree.filter.SearchResults;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+
+/**
+ * An in-memory index used for comparative benchmarking and testing
+ */
+public class FakeIndex implements LayerIndexReader, Constants {
+
+ public FakeIndex(Layer layer, IndexManager indexManager) {
+ init(null, indexManager, layer);
+ }
+
+ @Override
+ public void init(Transaction ignored, IndexManager indexManager, Layer layer) {
+ this.layer = layer;
+ }
+
+ @Override
+ public Layer getLayer() {
+ return layer;
+ }
+
+ @Override
+ public int count(Transaction tx) {
+ int count = 0;
+
+ // @TODO: Consider adding a count method to Layer or SpatialDataset to allow for
+ // optimization of this if this kind of code gets used elsewhere
+ for (@SuppressWarnings("unused") Node node : layer.getDataset().getAllGeometryNodes(tx)) {
+ count++;
+ }
+
+ return count;
+ }
+
+ @Override
+ public boolean isEmpty(Transaction tx) {
+ return count(tx) == 0;
+ }
+
+ @Override
+ public Envelope getBoundingBox(Transaction tx) {
+ Envelope bbox = null;
+
+ GeometryEncoder geomEncoder = layer.getGeometryEncoder();
+ for (Node node : layer.getDataset().getAllGeometryNodes(tx)) {
+ if (bbox == null) {
+ bbox = geomEncoder.decodeEnvelope(node);
+ } else {
+ bbox.expandToInclude(geomEncoder.decodeEnvelope(node));
+ }
+ }
+
+ return bbox;
+ }
+
+ public SpatialDatabaseRecord get(Transaction tx, String geomNodeId) {
+ return new SpatialDatabaseRecord(layer, tx.getNodeByElementId(geomNodeId));
+ }
+
+ public List get(Transaction tx, Set geomNodeIds) {
+ List results = new ArrayList<>();
+
+ for (String geomNodeId : geomNodeIds) {
+ results.add(get(tx, geomNodeId));
+ }
+
+ return results;
+ }
+
+ @Override
+ public Iterable getAllIndexedNodes(Transaction tx) {
+ return layer.getIndex().getAllIndexedNodes(tx);
+ }
+
+ @Override
+ public EnvelopeDecoder getEnvelopeDecoder() {
+ return layer.getGeometryEncoder();
+ }
+
+
+ @Override
+ public boolean isNodeIndexed(Transaction tx, String nodeId) {
+ // TODO
+ return true;
+ }
+
+ // Attributes
+
+ private Layer layer;
+
+ private class NodeFilter implements Iterable, Iterator {
+
+ private final Transaction tx;
+ private final SearchFilter filter;
+ private Node nextNode;
+ private final Iterator nodes;
+
+ NodeFilter(Transaction tx, SearchFilter filter, Iterable nodes) {
+ this.tx = tx;
+ this.filter = filter;
+ this.nodes = nodes.iterator();
+ nextNode = getNextNode();
+ }
+
+ @Override
+ public Iterator iterator() {
+ return this;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return nextNode != null;
+ }
+
+ @Override
+ public Node next() {
+ Node currentNode = nextNode;
+ nextNode = getNextNode();
+ return currentNode;
+ }
+
+ private Node getNextNode() {
+ Node nn = null;
+ while (nodes.hasNext()) {
+ Node node = nodes.next();
+ if (filter.geometryMatches(tx, node)) {
+ nn = node;
+ break;
+ }
+ }
+ return nn;
+ }
+
+ @Override
+ public void remove() {
+ }
+ }
+
+ @Override
+ public SearchResults searchIndex(Transaction tx, SearchFilter filter) {
+ return new SearchResults(new NodeFilter(tx, filter, layer.getDataset().getAllGeometryNodes(tx)));
+ }
+
+ @Override
+ public void addMonitor(TreeMonitor monitor) {
+ }
+
+ @Override
+ public void configure(Map config) {
+ }
+
+ @Override
+ public SearchRecords search(Transaction tx, SearchFilter filter) {
+ return new SearchRecords(layer, searchIndex(tx, filter));
+ }
+}
diff --git a/src/test/java/org/neo4j/gis/spatial/LayerSignatureTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/LayerSignatureTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/LayerSignatureTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/LayerSignatureTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/LayersTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/LayersTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/LayersTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/LayersTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/Neo4jSpatialDataStoreTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/Neo4jSpatialDataStoreTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/Neo4jSpatialDataStoreTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/Neo4jSpatialDataStoreTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java
diff --git a/src/test/java/org/neo4j/gis/spatial/Neo4jTestUtils.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/Neo4jTestUtils.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/Neo4jTestUtils.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/Neo4jTestUtils.java
diff --git a/src/test/java/org/neo4j/gis/spatial/OsmAnalysisTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/OsmAnalysisTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/OsmAnalysisTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/OsmAnalysisTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/ProgressLoggingListenerTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/ProgressLoggingListenerTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/ProgressLoggingListenerTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/ProgressLoggingListenerTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/RTreeBulkInsertTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/RTreeBulkInsertTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/RTreeBulkInsertTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/RTreeBulkInsertTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/RTreeTestUtils.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/RTreeTestUtils.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/RTreeTestUtils.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/RTreeTestUtils.java
diff --git a/src/test/java/org/neo4j/gis/spatial/SpatialIndexPerformanceProxy.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/SpatialIndexPerformanceProxy.java
similarity index 96%
rename from src/test/java/org/neo4j/gis/spatial/SpatialIndexPerformanceProxy.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/SpatialIndexPerformanceProxy.java
index 5e8cc634e..c2875d894 100644
--- a/src/test/java/org/neo4j/gis/spatial/SpatialIndexPerformanceProxy.java
+++ b/server-plugin/src/test/java/org/neo4j/gis/spatial/SpatialIndexPerformanceProxy.java
@@ -1,138 +1,138 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import java.util.Map;
-import org.neo4j.gis.spatial.filter.SearchRecords;
-import org.neo4j.gis.spatial.index.IndexManager;
-import org.neo4j.gis.spatial.index.LayerIndexReader;
-import org.neo4j.gis.spatial.rtree.Envelope;
-import org.neo4j.gis.spatial.rtree.EnvelopeDecoder;
-import org.neo4j.gis.spatial.rtree.TreeMonitor;
-import org.neo4j.gis.spatial.rtree.filter.SearchFilter;
-import org.neo4j.gis.spatial.rtree.filter.SearchResults;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-
-/**
- * A proxy wrapping the normal spatial index for the purpose of performance measurements.
- */
-public class SpatialIndexPerformanceProxy implements LayerIndexReader {
-
- private final LayerIndexReader spatialIndex;
-
- public SpatialIndexPerformanceProxy(LayerIndexReader spatialIndex) {
- this.spatialIndex = spatialIndex;
- }
-
- @Override
- public void init(Transaction tx, IndexManager indexManager, Layer layer) {
- if (layer != getLayer()) {
- throw new IllegalArgumentException("Cannot change layer associated with this index");
- }
- }
-
- @Override
- public Layer getLayer() {
- return spatialIndex.getLayer();
- }
-
- @Override
- public boolean isEmpty(Transaction tx) {
- long start = System.currentTimeMillis();
- boolean result = spatialIndex.isEmpty(tx);
- long stop = System.currentTimeMillis();
- System.out.println("# exec time(count): " + (stop - start) + "ms");
- return result;
- }
-
- @Override
- public int count(Transaction tx) {
- long start = System.currentTimeMillis();
- int count = spatialIndex.count(tx);
- long stop = System.currentTimeMillis();
- System.out.println("# exec time(count): " + (stop - start) + "ms");
- return count;
- }
-
- public Iterable getAllGeometryNodes(Transaction tx) {
- return spatialIndex.getAllIndexedNodes(tx);
- }
-
- @Override
- public EnvelopeDecoder getEnvelopeDecoder() {
- return spatialIndex.getEnvelopeDecoder();
- }
-
- @Override
- public Envelope getBoundingBox(Transaction tx) {
- long start = System.currentTimeMillis();
- Envelope result = spatialIndex.getBoundingBox(tx);
- long stop = System.currentTimeMillis();
- System.out.println("# exec time(getBoundingBox()): " + (stop - start) + "ms");
- return result;
- }
-
- @Override
- public boolean isNodeIndexed(Transaction tx, String nodeId) {
- long start = System.currentTimeMillis();
- boolean result = spatialIndex.isNodeIndexed(tx, nodeId);
- long stop = System.currentTimeMillis();
- System.out.println("# exec time(isNodeIndexed(" + nodeId + ")): " + (stop - start) + "ms");
- return result;
- }
-
- @Override
- public Iterable getAllIndexedNodes(Transaction tx) {
- long start = System.currentTimeMillis();
- Iterable result = spatialIndex.getAllIndexedNodes(tx);
- long stop = System.currentTimeMillis();
- System.out.println("# exec time(getAllIndexedNodes()): " + (stop - start) + "ms");
- return result;
- }
-
- @Override
- public SearchResults searchIndex(Transaction tx, SearchFilter filter) {
- long start = System.currentTimeMillis();
- SearchResults results = spatialIndex.searchIndex(tx, filter);
- long stop = System.currentTimeMillis();
- System.out.println("# exec time(executeSearch(" + filter + ")): " + (stop - start) + "ms");
- return results;
- }
-
- @Override
- public void addMonitor(TreeMonitor monitor) {
-
- }
-
- @Override
- public void configure(Map config) {
-
- }
-
- @Override
- public SearchRecords search(Transaction tx, SearchFilter filter) {
- long start = System.currentTimeMillis();
- SearchRecords results = spatialIndex.search(tx, filter);
- long stop = System.currentTimeMillis();
- System.out.println("# exec time(executeSearch(" + filter + ")): " + (stop - start) + "ms");
- return results;
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import java.util.Map;
+import org.neo4j.gis.spatial.filter.SearchRecords;
+import org.neo4j.gis.spatial.index.IndexManager;
+import org.neo4j.gis.spatial.index.LayerIndexReader;
+import org.neo4j.gis.spatial.rtree.Envelope;
+import org.neo4j.gis.spatial.rtree.EnvelopeDecoder;
+import org.neo4j.gis.spatial.rtree.TreeMonitor;
+import org.neo4j.gis.spatial.rtree.filter.SearchFilter;
+import org.neo4j.gis.spatial.rtree.filter.SearchResults;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+
+/**
+ * A proxy wrapping the normal spatial index for the purpose of performance measurements.
+ */
+public class SpatialIndexPerformanceProxy implements LayerIndexReader {
+
+ private final LayerIndexReader spatialIndex;
+
+ public SpatialIndexPerformanceProxy(LayerIndexReader spatialIndex) {
+ this.spatialIndex = spatialIndex;
+ }
+
+ @Override
+ public void init(Transaction tx, IndexManager indexManager, Layer layer) {
+ if (layer != getLayer()) {
+ throw new IllegalArgumentException("Cannot change layer associated with this index");
+ }
+ }
+
+ @Override
+ public Layer getLayer() {
+ return spatialIndex.getLayer();
+ }
+
+ @Override
+ public boolean isEmpty(Transaction tx) {
+ long start = System.currentTimeMillis();
+ boolean result = spatialIndex.isEmpty(tx);
+ long stop = System.currentTimeMillis();
+ System.out.println("# exec time(count): " + (stop - start) + "ms");
+ return result;
+ }
+
+ @Override
+ public int count(Transaction tx) {
+ long start = System.currentTimeMillis();
+ int count = spatialIndex.count(tx);
+ long stop = System.currentTimeMillis();
+ System.out.println("# exec time(count): " + (stop - start) + "ms");
+ return count;
+ }
+
+ public Iterable getAllGeometryNodes(Transaction tx) {
+ return spatialIndex.getAllIndexedNodes(tx);
+ }
+
+ @Override
+ public EnvelopeDecoder getEnvelopeDecoder() {
+ return spatialIndex.getEnvelopeDecoder();
+ }
+
+ @Override
+ public Envelope getBoundingBox(Transaction tx) {
+ long start = System.currentTimeMillis();
+ Envelope result = spatialIndex.getBoundingBox(tx);
+ long stop = System.currentTimeMillis();
+ System.out.println("# exec time(getBoundingBox()): " + (stop - start) + "ms");
+ return result;
+ }
+
+ @Override
+ public boolean isNodeIndexed(Transaction tx, String nodeId) {
+ long start = System.currentTimeMillis();
+ boolean result = spatialIndex.isNodeIndexed(tx, nodeId);
+ long stop = System.currentTimeMillis();
+ System.out.println("# exec time(isNodeIndexed(" + nodeId + ")): " + (stop - start) + "ms");
+ return result;
+ }
+
+ @Override
+ public Iterable getAllIndexedNodes(Transaction tx) {
+ long start = System.currentTimeMillis();
+ Iterable result = spatialIndex.getAllIndexedNodes(tx);
+ long stop = System.currentTimeMillis();
+ System.out.println("# exec time(getAllIndexedNodes()): " + (stop - start) + "ms");
+ return result;
+ }
+
+ @Override
+ public SearchResults searchIndex(Transaction tx, SearchFilter filter) {
+ long start = System.currentTimeMillis();
+ SearchResults results = spatialIndex.searchIndex(tx, filter);
+ long stop = System.currentTimeMillis();
+ System.out.println("# exec time(executeSearch(" + filter + ")): " + (stop - start) + "ms");
+ return results;
+ }
+
+ @Override
+ public void addMonitor(TreeMonitor monitor) {
+
+ }
+
+ @Override
+ public void configure(Map config) {
+
+ }
+
+ @Override
+ public SearchRecords search(Transaction tx, SearchFilter filter) {
+ long start = System.currentTimeMillis();
+ SearchRecords results = spatialIndex.search(tx, filter);
+ long stop = System.currentTimeMillis();
+ System.out.println("# exec time(executeSearch(" + filter + ")): " + (stop - start) + "ms");
+ return results;
+ }
+}
diff --git a/src/test/java/org/neo4j/gis/spatial/TestDynamicLayers.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestDynamicLayers.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestDynamicLayers.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestDynamicLayers.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestIntersectsPathQueries.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestIntersectsPathQueries.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestIntersectsPathQueries.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestIntersectsPathQueries.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestOSMImport.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestOSMImport.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestOSMImport.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestOSMImport.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestOSMImportBase.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestOSMImportBase.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestOSMImportBase.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestOSMImportBase.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestProcess.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestProcess.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestProcess.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestProcess.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestReadOnlyTransactions.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestReadOnlyTransactions.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestReadOnlyTransactions.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestReadOnlyTransactions.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestRemove.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestRemove.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestRemove.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestRemove.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestSimplePointLayer.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestSimplePointLayer.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestSimplePointLayer.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestSimplePointLayer.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestSpatial.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatial.java
similarity index 97%
rename from src/test/java/org/neo4j/gis/spatial/TestSpatial.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatial.java
index 4de247ddf..3bfc359c5 100644
--- a/src/test/java/org/neo4j/gis/spatial/TestSpatial.java
+++ b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatial.java
@@ -1,455 +1,455 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j Spatial.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gis.spatial;
-
-import static org.junit.jupiter.api.Assertions.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.HashMap;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.neo4j.gis.spatial.filter.SearchIntersect;
-import org.neo4j.gis.spatial.filter.SearchRecords;
-import org.neo4j.gis.spatial.index.IndexManager;
-import org.neo4j.gis.spatial.index.LayerIndexReader;
-import org.neo4j.gis.spatial.osm.OSMDataset;
-import org.neo4j.gis.spatial.osm.OSMImporter;
-import org.neo4j.gis.spatial.osm.OSMLayer;
-import org.neo4j.gis.spatial.rtree.Envelope;
-import org.neo4j.gis.spatial.rtree.NullListener;
-import org.neo4j.graphdb.Node;
-import org.neo4j.graphdb.Transaction;
-import org.neo4j.internal.kernel.api.security.SecurityContext;
-import org.neo4j.kernel.internal.GraphDatabaseAPI;
-
-/**
- *
- * Test cases for initial version of Neo4j-Spatial. This was originally
- * converted directly from Davide Savazzi's console applications:
- * ShapefileImporter, Test, Test2 and Test3. It was then extended substantially
- * by Craig to include tests for successful search of a number of specific
- * geometries in a number of specific shapefiles. After this tests for OSM
- * dataset import and search were added. The latest OSM work, specific to
- * DynamicLayer's is tested in the new test class TestDynamicLayers.
- *
- *
- * This class can also be configured on the command-line, java runtime
- * configuration or maven configuration. Set the java system property
- * spatial.test.mode to one of the following options:
- *
- * long
- * All known tests are run, regardless of the size of data or length of time
- * taken to test. This is good for infrequent tests with laeger data. It is
- * possible the maven dependencies will not include the necessary data to run
- * this test, so if you get failures, check that it is not simply missing data.
- * short
- * A very short set of tests are run, just as a quite check. This might be
- * one small SHP and one small OSM file, or even less
- * dev
- * Tests here change all the time as the developers are coding new features.
- * Craig in particular uses this place for a kind of TDD approach, writing tests
- * as he codes to drive the development. No guarranteee these tests will pass,
- * especially if something is only half coded
- * any other value, or leave unset
- * The default set of tests to run. This should be something that will work
- * well in the hudson build, as well as for developers downloading and trying
- * out neo4j-spatial
- *
- *
- */
-public class TestSpatial extends Neo4jTestCase {
-
- private final ArrayList layers = new ArrayList<>();
- private final HashMap layerTestEnvelope = new HashMap<>();
- private final HashMap> layerTestGeometries = new HashMap<>();
- private final HashMap layerTestFormats = new HashMap<>();
- private final HashMap geomStats = new HashMap<>();
- private final String spatialTestMode = System.getProperty("spatial.test.mode");
-
- @BeforeEach
- public void setUp() throws Exception {
- super.setUp();
-
- // TODO: Rather load this from a configuration file, properties file or JRuby test code
-
- Envelope bbox = new Envelope(12.9, 12.99, 56.05, 56.07); // covers half of Billesholm
-
- addTestLayer("billesholm.osm", DataFormat.OSM, bbox);
- addTestGeometry(70423036, "Ljungsgårdsvägen", "outside top left",
- "(12.9599540,56.0570692), (12.9624780,56.0716282)");
- addTestGeometry(67835020, "Villagatan", "in the middle", "(12.9776065,56.0561477), (12.9814421,56.0572131)");
- addTestGeometry(60966388, "Storgatan", "crossing left edge",
- "(12.9682980,56.0524546), (12.9710302,56.0538436)");
-
- bbox = new Envelope(12.5, 14.1, 55.0, 56.3); // cover central Skåne
- // Bounds for sweden_administrative: 11.1194502 : 24.1585511, 55.3550515 : 69.0600767
- // Envelope bbox = new Envelope(12.85, 13.25, 55.5, 55.65); // cover Malmö
- // Envelope bbox = new Envelope(13, 14, 55, 58); // cover admin area 'Söderåsen'
- // Envelope bbox = new Envelope(7, 10, 37, 40);
-
- addTestLayer("sweden.osm", DataFormat.OSM, bbox);
- addTestLayer("sweden.osm.administrative", DataFormat.OSM, bbox);
-
- addTestLayer("sweden_administrative", DataFormat.SHP, bbox);
- addTestGeometry(1055, "Söderåsens nationalpark", "near top edge",
- "(13.167721,56.002416), (13.289724,56.047099)");
- addTestGeometry(1067, "", "inside", "(13.2122907,55.6969478), (13.5614499,55.7835819)");
- addTestGeometry(943, "", "crosses left edge", "(12.9120438,55.8253138), (13.0501381,55.8484289)");
- addTestGeometry(884, "", "outside left", "(12.7492433,55.9269403), (12.9503304,55.964951)");
- addTestGeometry(1362, "", "crosses top right", "(13.7453871,55.9483067), (14.0084487,56.1538786)");
- addTestGeometry(1521, "", "outside right", "(14.0762394,55.4889569), (14.1869043,55.7592587)");
- addTestGeometry(1184, "", "outside above", "(13.4215555,56.109138), (13.4683671,56.2681347)");
-
- addTestLayer("sweden_natural", DataFormat.SHP, bbox);
- addTestGeometry(208, "Bokskogen", "", "(13.1935576,55.5324763), (13.2710125,55.5657891)");
- addTestGeometry(3462, "Pålsjö skog", "", "(12.6746748,56.0634246), (12.6934147,56.0776016)");
- addTestGeometry(647, "Dalby söderskog", "", "(13.32406,55.671652), (13.336948,55.679243)");
-
- addTestLayer("sweden_water", DataFormat.SHP, bbox);
- addTestGeometry(13149, "Yddingesjön", "", "(13.23564,55.5360264), (13.2676649,55.5558856)");
- addTestGeometry(14431, "Finjasjön", "", "(13.6718979,56.1157516), (13.7398759,56.1566911)");
-
- // TODO missing file
- addTestLayer("sweden_highway", DataFormat.SHP, bbox);
- addTestGeometry(58904, "Holmeja byväg", "", "(13.2819022,55.5561414), (13.2820848,55.5575418)");
- addTestGeometry(45305, "Yttre RIngvägen", "", "(12.9827334,55.5473645), (13.0118313,55.5480455)");
- addTestGeometry(43536, "Yttre RIngvägen", "", "(12.9412071,55.5564264), (12.9422181,55.5571701)");
- }
-
- private void addTestLayer(String layer, DataFormat format, Envelope bbox) {
- layers.add(layer);
- layerTestEnvelope.put(layer, bbox);
- layerTestFormats.put(layer, format);
- layerTestGeometries.put(layer, new ArrayList<>());
- }
-
- private void addTestGeometry(Integer id, String name, String comments, String bounds) {
- String layer = layers.get(layers.size() - 1);
- ArrayList geoms = layerTestGeometries.get(layer);
- geoms.add(new TestGeometry(id, name, comments, bounds));
- }
-
- @Test
- public void testShpSwedenAdministrative() throws Exception {
- if ("long".equals(spatialTestMode)) {
- testLayer("sweden_administrative");
- }
- }
-
- @Test
- public void testShpSwedenNatural() throws Exception {
- if ("long".equals(spatialTestMode)) {
- testLayer("sweden_natural");
- }
- }
-
- @Test
- public void testShpSwedenWater() throws Exception {
- if ("long".equals(spatialTestMode)) {
- testLayer("sweden_water");
- }
- }
-
- @Test
- public void testOsmBillesholm() throws Exception {
- testLayer("billesholm.osm");
- }
-
- @Test
- public void testOsmSwedenAdministrative() throws Exception {
- if ("long".equals(spatialTestMode)) {
- testLayer("sweden.osm.administrative");
- }
- }
-
- @Test
- public void testOsmSweden() throws Exception {
- if ("long".equals(spatialTestMode)) {
- testLayer("sweden.osm");
- }
- }
-
- // TODO missing file
- /*
- public void testShpSwedenHighway() throws Exception {
- if ("long".equals(spatialTestMode))
- testLayer("sweden_highway");
- } */
-
- private void testLayer(String layerName) throws Exception {
- testImport(layerName);
- testSpatialIndex(layerName);
- }
-
- private long countLayerIndex(String layerName) {
- long count = 0;
- try (Transaction tx = graphDb().beginTx()) {
- SpatialDatabaseService spatial = new SpatialDatabaseService(
- new IndexManager((GraphDatabaseAPI) graphDb(), SecurityContext.AUTH_DISABLED));
- Layer layer = spatial.getLayer(tx, layerName);
- if (layer != null && layer.getIndex() != null) {
- count = layer.getIndex().count(tx);
- }
- tx.commit();
- }
- return count;
- }
-
- private void testImport(String layerName) throws Exception {
- long start = System.currentTimeMillis();
- System.out.println("\n===========\n=========== Import Test: " + layerName + "\n===========");
- if (countLayerIndex(layerName) < 1) {
- switch (layerTestFormats.get(layerName)) {
- case SHP:
- loadTestShpData(layerName);
- break;
- case OSM:
- //TODO: enable batch again
- loadTestOsmData(layerName);
- break;
- default:
- fail("Unknown format: " + layerTestFormats.get(layerName));
- }
- } else {
- fail("Layer already present: " + layerName);
- }
-
- System.out.println("Total time for load: " + 1.0 * (System.currentTimeMillis() - start) / 1000.0 + "s");
- }
-
- private void loadTestShpData(String layerName) throws IOException {
- String SHP_DIR = "target/shp";
- String shpPath = SHP_DIR + File.separator + layerName;
- System.out.println("\n=== Loading layer " + layerName + " from " + shpPath + " ===");
- ShapefileImporter importer = new ShapefileImporter(graphDb(), new NullListener(), 1000, true);
- importer.importFile(shpPath, layerName, StandardCharsets.UTF_8);
- }
-
- private void loadTestOsmData(String layerName) throws Exception {
- String OSM_DIR = "target/osm";
- String osmPath = OSM_DIR + File.separator + layerName;
- System.out.println("\n=== Loading layer " + layerName + " from " + osmPath + " ===");
- OSMImporter importer = new OSMImporter(layerName);
- importer.setCharset(StandardCharsets.UTF_8);
- importer.importFile(graphDb(), osmPath);
- importer.reIndex(graphDb(), 1000);
- }
-
- private void testSpatialIndex(String layerName) {
- System.out.println("\n=== Spatial Index Test: " + layerName + " ===");
- long start = System.currentTimeMillis();
-
- SpatialDatabaseService spatial = new SpatialDatabaseService(
- new IndexManager((GraphDatabaseAPI) graphDb(), SecurityContext.AUTH_DISABLED));
- try (Transaction tx = graphDb().beginTx()) {
- Layer layer = spatial.getLayer(tx, layerName);
- if (layer == null || layer.getIndex() == null || layer.getIndex().count(tx) < 1) {
- fail("Layer not loaded: " + layerName);
- }
- OSMDataset.fromLayer(tx, (OSMLayer) layer); // force lookup
-
- LayerIndexReader fakeIndex = new SpatialIndexPerformanceProxy(new FakeIndex(layer, spatial.indexManager));
- LayerIndexReader rtreeIndex = new SpatialIndexPerformanceProxy(layer.getIndex());
-
- System.out.println("RTreeIndex bounds: " + rtreeIndex.getBoundingBox(tx));
- System.out.println("FakeIndex bounds: " + fakeIndex.getBoundingBox(tx));
- assertEnvelopeEquals(fakeIndex.getBoundingBox(tx), rtreeIndex.getBoundingBox(tx));
-
- System.out.println("RTreeIndex count: " + rtreeIndex.count(tx));
- Assertions.assertEquals(fakeIndex.count(tx), rtreeIndex.count(tx));
-
- Envelope bbox = layerTestEnvelope.get(layerName);
-
- System.out.println(
- "Displaying test geometries for layer '" + layerName + "' including expected search results");
- for (TestGeometry testData : layerTestGeometries.get(layerName)) {
- System.out.println("\tGeometry: " + testData + " " + (testData.inOrIntersects(bbox) ? "is" : "is NOT")
- + " inside search region");
- }
-
- for (LayerIndexReader index : new LayerIndexReader[]{rtreeIndex, fakeIndex}) {
- ArrayList foundData = new ArrayList<>();
-
- SearchIntersect searchQuery = new SearchIntersect(layer,
- layer.getGeometryFactory().toGeometry(Utilities.fromNeo4jToJts(bbox)));
- SearchRecords results = index.search(tx, searchQuery);
-
- int count = 0;
- int ri = 0;
- for (SpatialDatabaseRecord r : results) {
- count++;
- if (ri++ < 10) {
- StringBuilder props = new StringBuilder();
- for (String prop : r.getPropertyNames(tx)) {
- if (props.length() > 0) {
- props.append(", ");
- }
- props.append(prop).append(": ").append(r.getProperty(tx, prop));
- }
-
- System.out.println(
- "\tRTreeIndex result[" + ri + "]: " + r.getNodeId() + ":" + r.getType() + " - " + r
- + ": PROPS[" + props + "]");
- } else if (ri == 10) {
- System.out.println("\t.. and " + (count - ri) + " more ..");
- }
-
- addGeomStats(r.getGeomNode());
-
- String name = (String) r.getProperty(tx, "NAME");
- if (name == null) {
- name = (String) r.getProperty(tx, "name");
- }
-
- Integer id = (Integer) r.getProperty(tx, "ID");
- if ((name != null && name.length() > 0) || id != null) {
- for (TestGeometry testData : layerTestGeometries.get(layerName)) {
- if ((name != null && name.length() > 0 && testData.name.equals(name))
- || (testData.id.equals(id))) {
- System.out.println(
- "\tFound match in test data: test[" + testData + "] == result[" + r + "]");
- foundData.add(testData);
- } /* else if(name != null && name.length()>0 && name.startsWith(testData.name.substring(0,1))) {
- System.out.println("\tOnly first character matched: test[" + testData + "] == result[" + r + "]");
- } */
- }
- } else {
- System.err.println(
- "\tNo name or id in RTreeIndex result: " + r.getNodeId() + ":" + r.getType() + " - "
- + r);
- }
- }
-
- dumpGeomStats();
-
- System.out.println("Found " + foundData.size() + " test datasets in region[" + bbox + "]");
- for (TestGeometry testData : foundData) {
- System.out.println("\t" + testData + ": " + testData.bounds);
- }
-
- System.out.println(
- "Verifying results for " + layerTestGeometries.size() + " test datasets in region[" + bbox
- + "]");
- for (TestGeometry testData : layerTestGeometries.get(layerName)) {
- System.out.println("\ttesting " + testData + ": " + testData.bounds);
- if (testData.inOrIntersects(bbox) && !foundData.contains(testData)) {
- String error =
- "Incorrect test result: test[" + testData + "] not found by search inside region["
- + bbox + "]";
- for (TestGeometry data : foundData) {
- System.out.println(data);
- }
- System.out.println(error);
- fail(error);
- }
- }
- }
-
- System.out.println(
- "Total time for index test: " + 1.0 * (System.currentTimeMillis() - start) / 1000.0 + "s");
- tx.commit();
- }
- }
-
- private static void assertEnvelopeEquals(Envelope a, Envelope b) {
- Assertions.assertNotNull(a);
- Assertions.assertNotNull(b);
- Assertions.assertEquals(a.getDimension(), b.getDimension());
-
- for (int i = 0; i < a.getDimension(); i++) {
- Assertions.assertEquals(a.getMin(i), b.getMin(i), 0);
- Assertions.assertEquals(a.getMax(i), b.getMax(i), 0);
- }
- }
-
- private void addGeomStats(Node geomNode) {
- addGeomStats((Integer) geomNode.getProperty(Constants.PROP_TYPE, null));
- }
-
- private void addGeomStats(Integer geom) {
- Integer count = geomStats.get(geom);
- geomStats.put(geom, count == null ? 1 : count + 1);
- }
-
- private void dumpGeomStats() {
- System.out.println("Geometry statistics for " + geomStats.size() + " geometry types:");
- for (Integer key : geomStats.keySet()) {
- Integer count = geomStats.get(key);
- System.out.println("\t" + SpatialDatabaseService.convertGeometryTypeToName(key) + ": " + count);
- }
- geomStats.clear();
- }
-
- private enum DataFormat {
- SHP("ESRI Shapefile"), OSM("OpenStreetMap");
-
- private final String description;
-
- DataFormat(String description) {
- this.description = description;
- }
-
- @Override
- public String toString() {
- return description;
- }
- }
-
- /**
- * This class represents mock objects for representing geometries in simple form in memory for
- * testing against real geometries. We have a few hard-coded test geometries we expect to find
- * stored in predictable ways in the test database. Currently we only test for bounding box so
- * this class only contains that information.
- */
- private static class TestGeometry {
-
- private final Integer id;
- private final String name;
- private final String comments;
- protected Envelope bounds;
-
- public TestGeometry(Integer id, String name, String comments, String bounds) {
- this.id = id;
- this.name = name == null ? "" : name;
- this.comments = comments;
-
- float[] bf = new float[4];
- int bi = 0;
- for (String bound : bounds.replaceAll("[()\\s]+", "").split(",")) {
- bf[bi++] = Float.parseFloat(bound);
- }
- this.bounds = new Envelope(bf[0], bf[2], bf[1], bf[3]);
- }
-
- @Override
- public String toString() {
- return (name.length() > 0 ? name : "ID[" + id + "]") + (comments == null || comments.length() < 1 ? ""
- : " (" + comments + ")");
- }
-
- public boolean inOrIntersects(Envelope env) {
- return env.intersects(bounds);
- }
- }
-}
+/*
+ * Copyright (c) "Neo4j"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j Spatial.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.gis.spatial;
+
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.neo4j.gis.spatial.filter.SearchIntersect;
+import org.neo4j.gis.spatial.filter.SearchRecords;
+import org.neo4j.gis.spatial.index.IndexManager;
+import org.neo4j.gis.spatial.index.LayerIndexReader;
+import org.neo4j.gis.spatial.osm.OSMDataset;
+import org.neo4j.gis.spatial.osm.OSMImporter;
+import org.neo4j.gis.spatial.osm.OSMLayer;
+import org.neo4j.gis.spatial.rtree.Envelope;
+import org.neo4j.gis.spatial.rtree.NullListener;
+import org.neo4j.graphdb.Node;
+import org.neo4j.graphdb.Transaction;
+import org.neo4j.internal.kernel.api.security.SecurityContext;
+import org.neo4j.kernel.internal.GraphDatabaseAPI;
+
+/**
+ *
+ * Test cases for initial version of Neo4j-Spatial. This was originally
+ * converted directly from Davide Savazzi's console applications:
+ * ShapefileImporter, Test, Test2 and Test3. It was then extended substantially
+ * by Craig to include tests for successful search of a number of specific
+ * geometries in a number of specific shapefiles. After this tests for OSM
+ * dataset import and search were added. The latest OSM work, specific to
+ * DynamicLayer's is tested in the new test class TestDynamicLayers.
+ *
+ *
+ * This class can also be configured on the command-line, java runtime
+ * configuration or maven configuration. Set the java system property
+ * spatial.test.mode to one of the following options:
+ *
+ * long
+ * All known tests are run, regardless of the size of data or length of time
+ * taken to test. This is good for infrequent tests with laeger data. It is
+ * possible the maven dependencies will not include the necessary data to run
+ * this test, so if you get failures, check that it is not simply missing data.
+ * short
+ * A very short set of tests are run, just as a quite check. This might be
+ * one small SHP and one small OSM file, or even less
+ * dev
+ * Tests here change all the time as the developers are coding new features.
+ * Craig in particular uses this place for a kind of TDD approach, writing tests
+ * as he codes to drive the development. No guarranteee these tests will pass,
+ * especially if something is only half coded
+ * any other value, or leave unset
+ * The default set of tests to run. This should be something that will work
+ * well in the hudson build, as well as for developers downloading and trying
+ * out neo4j-spatial
+ *
+ *
+ */
+public class TestSpatial extends Neo4jTestCase {
+
+ private final ArrayList layers = new ArrayList<>();
+ private final HashMap layerTestEnvelope = new HashMap<>();
+ private final HashMap> layerTestGeometries = new HashMap<>();
+ private final HashMap layerTestFormats = new HashMap<>();
+ private final HashMap geomStats = new HashMap<>();
+ private final String spatialTestMode = System.getProperty("spatial.test.mode");
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ super.setUp();
+
+ // TODO: Rather load this from a configuration file, properties file or JRuby test code
+
+ Envelope bbox = new Envelope(12.9, 12.99, 56.05, 56.07); // covers half of Billesholm
+
+ addTestLayer("billesholm.osm", DataFormat.OSM, bbox);
+ addTestGeometry(70423036, "Ljungsgårdsvägen", "outside top left",
+ "(12.9599540,56.0570692), (12.9624780,56.0716282)");
+ addTestGeometry(67835020, "Villagatan", "in the middle", "(12.9776065,56.0561477), (12.9814421,56.0572131)");
+ addTestGeometry(60966388, "Storgatan", "crossing left edge",
+ "(12.9682980,56.0524546), (12.9710302,56.0538436)");
+
+ bbox = new Envelope(12.5, 14.1, 55.0, 56.3); // cover central Skåne
+ // Bounds for sweden_administrative: 11.1194502 : 24.1585511, 55.3550515 : 69.0600767
+ // Envelope bbox = new Envelope(12.85, 13.25, 55.5, 55.65); // cover Malmö
+ // Envelope bbox = new Envelope(13, 14, 55, 58); // cover admin area 'Söderåsen'
+ // Envelope bbox = new Envelope(7, 10, 37, 40);
+
+ addTestLayer("sweden.osm", DataFormat.OSM, bbox);
+ addTestLayer("sweden.osm.administrative", DataFormat.OSM, bbox);
+
+ addTestLayer("sweden_administrative", DataFormat.SHP, bbox);
+ addTestGeometry(1055, "Söderåsens nationalpark", "near top edge",
+ "(13.167721,56.002416), (13.289724,56.047099)");
+ addTestGeometry(1067, "", "inside", "(13.2122907,55.6969478), (13.5614499,55.7835819)");
+ addTestGeometry(943, "", "crosses left edge", "(12.9120438,55.8253138), (13.0501381,55.8484289)");
+ addTestGeometry(884, "", "outside left", "(12.7492433,55.9269403), (12.9503304,55.964951)");
+ addTestGeometry(1362, "", "crosses top right", "(13.7453871,55.9483067), (14.0084487,56.1538786)");
+ addTestGeometry(1521, "", "outside right", "(14.0762394,55.4889569), (14.1869043,55.7592587)");
+ addTestGeometry(1184, "", "outside above", "(13.4215555,56.109138), (13.4683671,56.2681347)");
+
+ addTestLayer("sweden_natural", DataFormat.SHP, bbox);
+ addTestGeometry(208, "Bokskogen", "", "(13.1935576,55.5324763), (13.2710125,55.5657891)");
+ addTestGeometry(3462, "Pålsjö skog", "", "(12.6746748,56.0634246), (12.6934147,56.0776016)");
+ addTestGeometry(647, "Dalby söderskog", "", "(13.32406,55.671652), (13.336948,55.679243)");
+
+ addTestLayer("sweden_water", DataFormat.SHP, bbox);
+ addTestGeometry(13149, "Yddingesjön", "", "(13.23564,55.5360264), (13.2676649,55.5558856)");
+ addTestGeometry(14431, "Finjasjön", "", "(13.6718979,56.1157516), (13.7398759,56.1566911)");
+
+ // TODO missing file
+ addTestLayer("sweden_highway", DataFormat.SHP, bbox);
+ addTestGeometry(58904, "Holmeja byväg", "", "(13.2819022,55.5561414), (13.2820848,55.5575418)");
+ addTestGeometry(45305, "Yttre RIngvägen", "", "(12.9827334,55.5473645), (13.0118313,55.5480455)");
+ addTestGeometry(43536, "Yttre RIngvägen", "", "(12.9412071,55.5564264), (12.9422181,55.5571701)");
+ }
+
+ private void addTestLayer(String layer, DataFormat format, Envelope bbox) {
+ layers.add(layer);
+ layerTestEnvelope.put(layer, bbox);
+ layerTestFormats.put(layer, format);
+ layerTestGeometries.put(layer, new ArrayList<>());
+ }
+
+ private void addTestGeometry(Integer id, String name, String comments, String bounds) {
+ String layer = layers.get(layers.size() - 1);
+ ArrayList geoms = layerTestGeometries.get(layer);
+ geoms.add(new TestGeometry(id, name, comments, bounds));
+ }
+
+ @Test
+ public void testShpSwedenAdministrative() throws Exception {
+ if ("long".equals(spatialTestMode)) {
+ testLayer("sweden_administrative");
+ }
+ }
+
+ @Test
+ public void testShpSwedenNatural() throws Exception {
+ if ("long".equals(spatialTestMode)) {
+ testLayer("sweden_natural");
+ }
+ }
+
+ @Test
+ public void testShpSwedenWater() throws Exception {
+ if ("long".equals(spatialTestMode)) {
+ testLayer("sweden_water");
+ }
+ }
+
+ @Test
+ public void testOsmBillesholm() throws Exception {
+ testLayer("billesholm.osm");
+ }
+
+ @Test
+ public void testOsmSwedenAdministrative() throws Exception {
+ if ("long".equals(spatialTestMode)) {
+ testLayer("sweden.osm.administrative");
+ }
+ }
+
+ @Test
+ public void testOsmSweden() throws Exception {
+ if ("long".equals(spatialTestMode)) {
+ testLayer("sweden.osm");
+ }
+ }
+
+ // TODO missing file
+ /*
+ public void testShpSwedenHighway() throws Exception {
+ if ("long".equals(spatialTestMode))
+ testLayer("sweden_highway");
+ } */
+
+ private void testLayer(String layerName) throws Exception {
+ testImport(layerName);
+ testSpatialIndex(layerName);
+ }
+
+ private long countLayerIndex(String layerName) {
+ long count = 0;
+ try (Transaction tx = graphDb().beginTx()) {
+ SpatialDatabaseService spatial = new SpatialDatabaseService(
+ new IndexManager((GraphDatabaseAPI) graphDb(), SecurityContext.AUTH_DISABLED));
+ Layer layer = spatial.getLayer(tx, layerName);
+ if (layer != null && layer.getIndex() != null) {
+ count = layer.getIndex().count(tx);
+ }
+ tx.commit();
+ }
+ return count;
+ }
+
+ private void testImport(String layerName) throws Exception {
+ long start = System.currentTimeMillis();
+ System.out.println("\n===========\n=========== Import Test: " + layerName + "\n===========");
+ if (countLayerIndex(layerName) < 1) {
+ switch (layerTestFormats.get(layerName)) {
+ case SHP:
+ loadTestShpData(layerName);
+ break;
+ case OSM:
+ //TODO: enable batch again
+ loadTestOsmData(layerName);
+ break;
+ default:
+ fail("Unknown format: " + layerTestFormats.get(layerName));
+ }
+ } else {
+ fail("Layer already present: " + layerName);
+ }
+
+ System.out.println("Total time for load: " + 1.0 * (System.currentTimeMillis() - start) / 1000.0 + "s");
+ }
+
+ private void loadTestShpData(String layerName) throws IOException {
+ String SHP_DIR = "target/shp";
+ String shpPath = SHP_DIR + File.separator + layerName;
+ System.out.println("\n=== Loading layer " + layerName + " from " + shpPath + " ===");
+ ShapefileImporter importer = new ShapefileImporter(graphDb(), new NullListener(), 1000, true);
+ importer.importFile(shpPath, layerName, StandardCharsets.UTF_8);
+ }
+
+ private void loadTestOsmData(String layerName) throws Exception {
+ String OSM_DIR = "target/osm";
+ String osmPath = OSM_DIR + File.separator + layerName;
+ System.out.println("\n=== Loading layer " + layerName + " from " + osmPath + " ===");
+ OSMImporter importer = new OSMImporter(layerName);
+ importer.setCharset(StandardCharsets.UTF_8);
+ importer.importFile(graphDb(), osmPath);
+ importer.reIndex(graphDb(), 1000);
+ }
+
+ private void testSpatialIndex(String layerName) {
+ System.out.println("\n=== Spatial Index Test: " + layerName + " ===");
+ long start = System.currentTimeMillis();
+
+ SpatialDatabaseService spatial = new SpatialDatabaseService(
+ new IndexManager((GraphDatabaseAPI) graphDb(), SecurityContext.AUTH_DISABLED));
+ try (Transaction tx = graphDb().beginTx()) {
+ Layer layer = spatial.getLayer(tx, layerName);
+ if (layer == null || layer.getIndex() == null || layer.getIndex().count(tx) < 1) {
+ fail("Layer not loaded: " + layerName);
+ }
+ OSMDataset.fromLayer(tx, (OSMLayer) layer); // force lookup
+
+ LayerIndexReader fakeIndex = new SpatialIndexPerformanceProxy(new FakeIndex(layer, spatial.indexManager));
+ LayerIndexReader rtreeIndex = new SpatialIndexPerformanceProxy(layer.getIndex());
+
+ System.out.println("RTreeIndex bounds: " + rtreeIndex.getBoundingBox(tx));
+ System.out.println("FakeIndex bounds: " + fakeIndex.getBoundingBox(tx));
+ assertEnvelopeEquals(fakeIndex.getBoundingBox(tx), rtreeIndex.getBoundingBox(tx));
+
+ System.out.println("RTreeIndex count: " + rtreeIndex.count(tx));
+ Assertions.assertEquals(fakeIndex.count(tx), rtreeIndex.count(tx));
+
+ Envelope bbox = layerTestEnvelope.get(layerName);
+
+ System.out.println(
+ "Displaying test geometries for layer '" + layerName + "' including expected search results");
+ for (TestGeometry testData : layerTestGeometries.get(layerName)) {
+ System.out.println("\tGeometry: " + testData + " " + (testData.inOrIntersects(bbox) ? "is" : "is NOT")
+ + " inside search region");
+ }
+
+ for (LayerIndexReader index : new LayerIndexReader[]{rtreeIndex, fakeIndex}) {
+ ArrayList foundData = new ArrayList<>();
+
+ SearchIntersect searchQuery = new SearchIntersect(layer,
+ layer.getGeometryFactory().toGeometry(Utilities.fromNeo4jToJts(bbox)));
+ SearchRecords results = index.search(tx, searchQuery);
+
+ int count = 0;
+ int ri = 0;
+ for (SpatialDatabaseRecord r : results) {
+ count++;
+ if (ri++ < 10) {
+ StringBuilder props = new StringBuilder();
+ for (String prop : r.getPropertyNames(tx)) {
+ if (props.length() > 0) {
+ props.append(", ");
+ }
+ props.append(prop).append(": ").append(r.getProperty(tx, prop));
+ }
+
+ System.out.println(
+ "\tRTreeIndex result[" + ri + "]: " + r.getNodeId() + ":" + r.getType() + " - " + r
+ + ": PROPS[" + props + "]");
+ } else if (ri == 10) {
+ System.out.println("\t.. and " + (count - ri) + " more ..");
+ }
+
+ addGeomStats(r.getGeomNode());
+
+ String name = (String) r.getProperty(tx, "NAME");
+ if (name == null) {
+ name = (String) r.getProperty(tx, "name");
+ }
+
+ Integer id = (Integer) r.getProperty(tx, "ID");
+ if ((name != null && name.length() > 0) || id != null) {
+ for (TestGeometry testData : layerTestGeometries.get(layerName)) {
+ if ((name != null && name.length() > 0 && testData.name.equals(name))
+ || (testData.id.equals(id))) {
+ System.out.println(
+ "\tFound match in test data: test[" + testData + "] == result[" + r + "]");
+ foundData.add(testData);
+ } /* else if(name != null && name.length()>0 && name.startsWith(testData.name.substring(0,1))) {
+ System.out.println("\tOnly first character matched: test[" + testData + "] == result[" + r + "]");
+ } */
+ }
+ } else {
+ System.err.println(
+ "\tNo name or id in RTreeIndex result: " + r.getNodeId() + ":" + r.getType() + " - "
+ + r);
+ }
+ }
+
+ dumpGeomStats();
+
+ System.out.println("Found " + foundData.size() + " test datasets in region[" + bbox + "]");
+ for (TestGeometry testData : foundData) {
+ System.out.println("\t" + testData + ": " + testData.bounds);
+ }
+
+ System.out.println(
+ "Verifying results for " + layerTestGeometries.size() + " test datasets in region[" + bbox
+ + "]");
+ for (TestGeometry testData : layerTestGeometries.get(layerName)) {
+ System.out.println("\ttesting " + testData + ": " + testData.bounds);
+ if (testData.inOrIntersects(bbox) && !foundData.contains(testData)) {
+ String error =
+ "Incorrect test result: test[" + testData + "] not found by search inside region["
+ + bbox + "]";
+ for (TestGeometry data : foundData) {
+ System.out.println(data);
+ }
+ System.out.println(error);
+ fail(error);
+ }
+ }
+ }
+
+ System.out.println(
+ "Total time for index test: " + 1.0 * (System.currentTimeMillis() - start) / 1000.0 + "s");
+ tx.commit();
+ }
+ }
+
+ private static void assertEnvelopeEquals(Envelope a, Envelope b) {
+ Assertions.assertNotNull(a);
+ Assertions.assertNotNull(b);
+ Assertions.assertEquals(a.getDimension(), b.getDimension());
+
+ for (int i = 0; i < a.getDimension(); i++) {
+ Assertions.assertEquals(a.getMin(i), b.getMin(i), 0);
+ Assertions.assertEquals(a.getMax(i), b.getMax(i), 0);
+ }
+ }
+
+ private void addGeomStats(Node geomNode) {
+ addGeomStats((Integer) geomNode.getProperty(Constants.PROP_TYPE, null));
+ }
+
+ private void addGeomStats(Integer geom) {
+ Integer count = geomStats.get(geom);
+ geomStats.put(geom, count == null ? 1 : count + 1);
+ }
+
+ private void dumpGeomStats() {
+ System.out.println("Geometry statistics for " + geomStats.size() + " geometry types:");
+ for (Integer key : geomStats.keySet()) {
+ Integer count = geomStats.get(key);
+ System.out.println("\t" + SpatialDatabaseService.convertGeometryTypeToName(key) + ": " + count);
+ }
+ geomStats.clear();
+ }
+
+ private enum DataFormat {
+ SHP("ESRI Shapefile"), OSM("OpenStreetMap");
+
+ private final String description;
+
+ DataFormat(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public String toString() {
+ return description;
+ }
+ }
+
+ /**
+ * This class represents mock objects for representing geometries in simple form in memory for
+ * testing against real geometries. We have a few hard-coded test geometries we expect to find
+ * stored in predictable ways in the test database. Currently we only test for bounding box so
+ * this class only contains that information.
+ */
+ private static class TestGeometry {
+
+ private final Integer id;
+ private final String name;
+ private final String comments;
+ protected Envelope bounds;
+
+ public TestGeometry(Integer id, String name, String comments, String bounds) {
+ this.id = id;
+ this.name = name == null ? "" : name;
+ this.comments = comments;
+
+ float[] bf = new float[4];
+ int bi = 0;
+ for (String bound : bounds.replaceAll("[()\\s]+", "").split(",")) {
+ bf[bi++] = Float.parseFloat(bound);
+ }
+ this.bounds = new Envelope(bf[0], bf[2], bf[1], bf[3]);
+ }
+
+ @Override
+ public String toString() {
+ return (name.length() > 0 ? name : "ID[" + id + "]") + (comments == null || comments.length() < 1 ? ""
+ : " (" + comments + ")");
+ }
+
+ public boolean inOrIntersects(Envelope env) {
+ return env.intersects(bounds);
+ }
+ }
+}
diff --git a/src/test/java/org/neo4j/gis/spatial/TestSpatialQueries.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatialQueries.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestSpatialQueries.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatialQueries.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestSpatialUtils.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatialUtils.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestSpatialUtils.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestSpatialUtils.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TestsForDocs.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TestsForDocs.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TestsForDocs.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TestsForDocs.java
diff --git a/src/test/java/org/neo4j/gis/spatial/TryWithResourceTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/TryWithResourceTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/TryWithResourceTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/TryWithResourceTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/functions/SpatialFunctionsTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/functions/SpatialFunctionsTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/functions/SpatialFunctionsTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/functions/SpatialFunctionsTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerGeohashNativePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerGeohashNativePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerGeohashNativePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerGeohashNativePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerGeohashSimplePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerGeohashSimplePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerGeohashSimplePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerGeohashSimplePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerHilbertNativePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerHilbertNativePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerHilbertNativePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerHilbertNativePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerHilbertSimplePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerHilbertSimplePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerHilbertSimplePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerHilbertSimplePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerIndexTestBase.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerIndexTestBase.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerIndexTestBase.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerIndexTestBase.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerRTreeNativePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerRTreeNativePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerRTreeNativePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerRTreeNativePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerRTreeSimplePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerRTreeSimplePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerRTreeSimplePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerRTreeSimplePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerZOrderNativePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerZOrderNativePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerZOrderNativePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerZOrderNativePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/LayerZOrderSimplePointIndexTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerZOrderSimplePointIndexTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/LayerZOrderSimplePointIndexTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/LayerZOrderSimplePointIndexTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/NativePointIndexTestBase.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/NativePointIndexTestBase.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/NativePointIndexTestBase.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/NativePointIndexTestBase.java
diff --git a/src/test/java/org/neo4j/gis/spatial/index/SimplePointIndexTestBase.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/index/SimplePointIndexTestBase.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/index/SimplePointIndexTestBase.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/index/SimplePointIndexTestBase.java
diff --git a/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java
similarity index 99%
rename from src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java
index ff53da449..a85575f95 100644
--- a/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java
+++ b/server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesDocTest.java
@@ -910,7 +910,7 @@ private void addImageSnippet(
bounds.expandBy(boundsDelta, boundsDelta);
StyledImageExporter exporter = new StyledImageExporter(db);
- exporter.setExportDir("docs/docs/modules/ROOT/images/generated");
+ exporter.setExportDir("../docs/docs/modules/ROOT/images/generated");
exporter.saveImage(
new FeatureCollection[]{
layerCollection,
@@ -999,7 +999,7 @@ public void setUp() {
gen.get().setGraph(db);
try (Transaction tx = db.beginTx()) {
StyledImageExporter exporter = new StyledImageExporter(db);
- exporter.setExportDir("docs/docs/modules/ROOT/images/generated/layers");
+ exporter.setExportDir("../docs/docs/modules/ROOT/images/generated/layers");
exporter.saveImage(GeoPipeline.start(tx, intersectionLayer).toFeatureCollection(tx),
StyledImageExporter.createDefaultStyle(Color.BLUE, Color.CYAN), new File(
"intersectionLayer.png"));
@@ -1032,7 +1032,7 @@ public void setUp() {
public void doc() {
JavaTestDocsGenerator docsGenerator = gen.get();
docsGenerator.addTestSourceSnippets(GeoPipesDocTest.class, "s_" + getTitle().toLowerCase());
- docsGenerator.document("docs/docs/modules/ROOT/pages/geo-pipes", "examples");
+ docsGenerator.document("../docs/docs/modules/ROOT/pages/geo-pipes", "examples");
if (tx != null) {
tx.commit();
tx.close();
@@ -1057,7 +1057,7 @@ public static void init() {
public static void writeIndexAdoc() throws IOException {
// write an index.adoc file including all generated snippets
var adocs = new TreeSet<>();
- Path path = Paths.get("docs/docs/modules/ROOT/pages/geo-pipes/examples/generated");
+ Path path = Paths.get("../docs/docs/modules/ROOT/pages/geo-pipes/examples/generated");
try (Stream paths = Files.walk(path)) {
paths.filter(Files::isRegularFile)
.filter(p -> p.toString().endsWith(".adoc"))
diff --git a/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesPerformanceTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesPerformanceTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesPerformanceTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/GeoPipesPerformanceTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/pipes/OrthodromicDistanceTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/OrthodromicDistanceTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/pipes/OrthodromicDistanceTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/pipes/OrthodromicDistanceTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java
diff --git a/src/test/java/org/neo4j/gis/spatial/rtree/EnvelopeTests.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/rtree/EnvelopeTests.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/rtree/EnvelopeTests.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/rtree/EnvelopeTests.java
diff --git a/src/test/java/org/neo4j/gis/spatial/rtree/RTreeTests.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/rtree/RTreeTests.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/rtree/RTreeTests.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/rtree/RTreeTests.java
diff --git a/src/test/java/org/neo4j/gis/spatial/rtree/TestRTreeIndex.java b/server-plugin/src/test/java/org/neo4j/gis/spatial/rtree/TestRTreeIndex.java
similarity index 100%
rename from src/test/java/org/neo4j/gis/spatial/rtree/TestRTreeIndex.java
rename to server-plugin/src/test/java/org/neo4j/gis/spatial/rtree/TestRTreeIndex.java
diff --git a/two-street.osm b/server-plugin/two-street.osm
similarity index 100%
rename from two-street.osm
rename to server-plugin/two-street.osm
diff --git a/withinDistance.osm b/server-plugin/withinDistance.osm
similarity index 100%
rename from withinDistance.osm
rename to server-plugin/withinDistance.osm
diff --git a/src/build/deploy.sh b/src/build/deploy.sh
deleted file mode 100755
index 9e057201d..000000000
--- a/src/build/deploy.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash -e
-# depends libxml-simple-perl
-
-tcrepo=http://builder.neo4j.org/guestAuth/repository/download/bt32/lastSuccessful
-# mvnrepo=https://repo.neo4j.org/content/repositories/snapshots
-mvnrepo=http://build-repo.neo4j.org/repository/snapshots/
-
-function work {
- deploy_defaults neo4j-spatial
- deploy_maven_type_classifier neo4j-spatial $version zip server-plugin
-}
-
-function deploy_defaults {
- for artifact in $@ ; do
- deploy $artifact docs javadoc sources test-sources tests
- done
-}
-
-function repeat_command {
- thecommand=$1
- echo $thecommand
- success=0
- for counter in 1 2 3
- do
- if $thecommand
- then
- success=1
- break
- fi
- echo "Command failed ($counter): $thecommand"
- done
- if [ $success == 0 ]
- then
- echo "Fatal command failure: $thecommand"
- exit 1
- fi
-}
-
-function fetch_artifact {
- artifact=$1
- filename=$2
- curlcommand="curl -f -O $tcrepo/$artifact/$filename"
- repeat_command "$curlcommand"
-}
-
-function deploy_maven_jar {
- artifact=$1
- version=$2
- filename=$artifact-$version.jar
- fetch_artifact $artifact $filename
- deploycommand="mvn deploy:deploy-file -Durl=$mvnrepo -DrepositoryId=snapshots -DuniqueVersion=false -Dfile=$filename -Dpackaging=jar -DpomFile=pom.xml"
- repeat_command "$deploycommand"
-}
-
-function deploy_maven_type_classifier {
- artifact=$1
- version=$2
- type=$3
- classifier=$4
- filename=$artifact-$version-$classifier.$type
- fetch_artifact $artifact $filename
- deploycommand="mvn deploy:deploy-file -Durl=$mvnrepo -DrepositoryId=snapshots -DuniqueVersion=false -Dfile=$filename -Dpackaging=$type -Dclassifier=$classifier -DpomFile=pom.xml"
- repeat_command "$deploycommand"
-}
-
-
-# uses the global $artifact as input
-function get_version {
- fetch_artifact $artifact pom.xml
- version=$( ./xmlgrep pom.xml )
- echo "**************************************************************"
- echo "artifact:$artifact version:$version"
-}
-
-function deploy_tarball {
- artifact=$1
- classifier=$2
- type=tar.gz
- get_version
- deploy_maven_type_classifier $artifact $version $type $classifier
-}
-
-function deploy {
- artifact=$1
- get_version
- deploy_maven_jar $artifact $version
- first=1
- for classifier in $@ ; do
- if [ -z $first ] ; then
- deploy_maven_type_classifier $artifact $version jar $classifier
- fi
- unset first
- done
-}
-
-## prepare working dir
-[ -e target/upload ] && rm -rf target/upload
-mkdir -p target/upload
-cd target/upload
-
-
-## create xml-version helper
-cat<xmlgrep
-#!/usr/bin/perl -w
-use XML::Simple;
-print XML::Simple->new()->XMLin(shift)->{'version'};
-EOF
-chmod +x xmlgrep
-
-###############
-work
diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
deleted file mode 100644
index 82e2a589c..000000000
--- a/src/site/apt/index.apt
+++ /dev/null
@@ -1,5 +0,0 @@
-Neo4j Spatial
-
- Neo4j Spatial is a library of utilities for Neo4j that facilitates the enabling of spatial operations on data.
- In particular you can add spatial indexes to already located data, and perform spatial operations on the data like searching for data within specified regions or within a specified distance of a point of interest.
- In addition classes are provided to expose the data to geotools and thereby to geotools enabled applications like geoserver and uDig.
diff --git a/src/site/pics/one-street.png b/src/site/pics/one-street.png
deleted file mode 100644
index d87e40bd5..000000000
Binary files a/src/site/pics/one-street.png and /dev/null differ
diff --git a/src/site/site.xml b/src/site/site.xml
deleted file mode 100644
index 605b5d00e..000000000
--- a/src/site/site.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
- ${project.name}
- images/logos/logo-dark.png
- https://neo4j.org/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${skinGroupId}
- ${skinArtifactId}
- ${skinVersion}
-
-
diff --git a/utils/makeDocs.sh b/utils/makeDocs.sh
deleted file mode 100755
index 4dcd6a832..000000000
--- a/utils/makeDocs.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-MANUAL=../spatial-manual
-
-if [ -d "$MANUAL" ] ; then
- mvn install -Dmaven.test.skip=true && (cd $MANUAL ; mvn install)
-else
- echo "No spatial-manual project found"
- echo "Try: cd .. ; git clone git@github.com:nawroth/spatial-manual.git"
-fi