Skip to content

Commit

Permalink
Migrate docs to be generated via antora (#421)
Browse files Browse the repository at this point in the history
Migrate docs to be generated via antora, so we can include them in the neo4j labs docs.

* use generated examples from code
* add simple server to serve antora docs for local testing
  • Loading branch information
Andy2003 authored Aug 28, 2024
1 parent 6e6dbb0 commit 5c86123
Show file tree
Hide file tree
Showing 108 changed files with 3,938 additions and 1,094 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- name: Update README.md
run: sed -i "s|<version>.*</version>|<version>${{ env.VERSION }}</version>|g" README.md

- name: Update Docs
run: 'sed -i "s|docs-version: .*|docs-version: ${{ env.VERSION }}|g" docs/docs/antora.yml'

- name: Commit release POM and Tag
run: |
git config --local user.email "[email protected]"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ target
/bin
LineString.*
results.*
docs/*
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
node_modules
16 changes: 16 additions & 0 deletions docs/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
site:
title: Neo4j-Spatial User Guide
url: /neo4j-spatial-docs
content:
sources:
- url: ../
start_path: docs/docs
branches: HEAD
ui:
bundle:
url: https://static-content.neo4j.com/build/ui-bundle.zip
snapshot: true
asciidoc:
attributes:
page-theme: docs
page-cdn: /_/
13 changes: 13 additions & 0 deletions docs/docs/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: neo4j-spatial
version: 5.0
title: Neo4j-Spatial User Guide
nav:
- modules/ROOT/nav.adoc

asciidoc:
attributes:
docs-version: 5.20
copyright: Neo4j Inc.
page-product: Neo4j Spatial
page-type: Neo4j Spatial Manual
page-canonical-root: /labs
1 change: 1 addition & 0 deletions docs/docs/modules/ROOT/examples/GeoPipesDocTest.java
1 change: 1 addition & 0 deletions docs/docs/modules/ROOT/examples/TestsForDocs.java
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/modules/ROOT/images/Udig-map2-rt90.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/modules/ROOT/images/Udig-map2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/modules/ROOT/images/generated/boundary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/modules/ROOT/images/generated/max.png
Binary file added docs/docs/modules/ROOT/images/generated/min.png
Binary file added docs/docs/modules/ROOT/images/generated/union.png
Binary file added docs/docs/modules/ROOT/images/one-street.png
Empty file.
5 changes: 5 additions & 0 deletions docs/docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* xref:overview/introduction.adoc[]
* xref::dev/index.adoc[]
** Examples
*** xref:geo-pipes/index.adoc[]
* xref:appendix/index.adoc[]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[[geoserver]]
= Neo4j Spatial in GeoServer

Neo4j Spatial includes built-in support for a GeoTools data store. This means it is, in principle, directly usable inside GeoServer. This document will discuss how to get it up and running in GeoServer. If you are interested in a desktop GIS, take a look at Neo4j Spatial in uDig.
Expand All @@ -6,7 +7,8 @@ Neo4j Spatial includes built-in support for a GeoTools data store. This means it

=== Installing GeoServer

First of all you need to download and install geoserver from http://geoserver.org/display/GEOS/Download. For detailed installation instructions, refer to the official GeoServer documentation athttp://docs.geoserver.org/stable/en/user/installation/index.html
First of all you need to download and install geoserver from http://geoserver.org/display/GEOS/Download.
For detailed installation instructions, refer to the official GeoServer documentation at http://docs.geoserver.org/stable/en/user/installation/index.html
Here we provide very basic instructions, with factors to consider regarding installing GeoServer with Neo4j Spatial:

* Choose the right version for the version of Neo4j Spatial you are going to use:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
= Neo4j Spatial in uDig

Neo4j Spatial supports Geotools, and therefor also Geotools based platforms like GeoServer and uDig. For information on setting up and running Neo4j Spatial in GeoServer, see the wiki page <<geoserver>>.
Neo4j Spatial supports Geotools, and therefor also Geotools based platforms like GeoServer and uDig.
For information on setting up and running Neo4j Spatial in GeoServer, see the section <<geoserver>>.

== uDig SDK

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[[spatial-examples]]
= Examples
:sourceDir: ../../../src/test/java
:leveloffset: 1

[[spatial-import-shapefile]]
== Importing a shapefile
Expand All @@ -10,7 +8,7 @@ Neo4j-Spatial includes a utility for importing ESRI Shapefile data. The Shapefil

[source,java,indent=0]
----
include::{sourceDir}/org/neo4j/gis/spatial/TestsForDocs.java[tags=importShapefile]
include::example$TestsForDocs.java[tags=importShapefile]
----

This code will import the layer 'highway' from the file 'shp/highway.shp' which is included in the source distribution. This layer will be indexed using an RTree and can therefore be queried using any of the supported spatial operations. See the example on querying layers below.
Expand All @@ -25,7 +23,7 @@ Refer to the unit tests in classes +TestDynamicLayers+ and +TestOSMImport+ for t

[source,java,indent=0]
----
include::{sourceDir}/org/neo4j/gis/spatial/TestsForDocs.java[tags=importOsm]
include::example$TestsForDocs.java[tags=importOsm]
----

This code will import the map.osm Open Street Map file, populating the database with a little over 200 geometries, including streets, buildings and points of interest.
Expand All @@ -38,7 +36,7 @@ Assuming you imported the map.osm file as in the previous example, you can now p

[source,java,indent=0]
----
include::{sourceDir}/org/neo4j/gis/spatial/TestsForDocs.java[tags=searchBBox]
include::example$TestsForDocs.java[tags=searchBBox]
----

For more examples of query code, refer to the test code in the +LayerTest+ and the +SpatialTest+ classes.
Expand All @@ -51,50 +49,18 @@ The ESRI Shapefile that we imported in the first example above was actually crea

[source,java,indent=0]
----
include::{sourceDir}/org/neo4j/gis/spatial/TestsForDocs.java[tags=exportShapefileFromOSM]
include::example$TestsForDocs.java[tags=exportShapefileFromOSM]
----

This example shows how we can import an OSM dataset, which contains data with a number of different Geometry types, and then by using a DynamicLayer to select for only geometries of type 'LineString', we can export all the OSM ways to a Shapefile. This is particularly important when you consider that ESRI Shapefile format does not allow more than one Geometry type per shapefile.

[source,java,indent=0]
----
include::{sourceDir}/org/neo4j/gis/spatial/TestsForDocs.java[tags=exportShapefileFromQuery]
include::example$TestsForDocs.java[tags=exportShapefileFromQuery]
----

This time we import the same OSM model, but query for all geometries inside an envelope, and export that to a new Shapefile.

[[spatial-geopipes]]
== GeoPipes

=== Base Layers

These are the different base layers being used for the following examples:

OsmLayer:

image::osmLayer.png[]

IntersectionLayer:

image::intersectionLayer.png[]

LinesLayer:

image::linesLayer.png[]

BoxesLayer:

image::boxesLayer.png[]

ConcaveLayer:

image::concaveLayer.png[]

EqualLayer:

image::equalLayer.png[]

:leveloffset: 2

include::geo-pipes.adoc[]
== More Examples

* xref:geo-pipes/index.adoc[]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

:toclevels: 1
= Development
:leveloffset: 1

include::indexing.adoc[]
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions docs/docs/modules/ROOT/pages/dev/layers.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[spatial-layers]]
= Layers and GeometryEncoders

The primary type that defines a collection of geometries is the `Layer`.
A layer contains an index for querying.
In addition, a `Layer` can be an `EditableLayer` if it is possible to add and modify geometries in the layer.
The next most important interface is the GeometryEncoder.

The `DefaultLayer` is the standard layer, making use of the `WKBGeometryEncoder` for storing all geometry types as `byte[]` properties of one node per geometry instance.

The `OSMLayer` is a special layer supporting Open Street Map and storing the OSM model as a single fully connected graph.
The set of `Geometries` provided by this layer includes `Points`, `LineStrings` and `Polygons`, and as such cannot be exported to Shapefile format, since that format only allows a single `Geometry` per layer.
However, `OMSLayer` extends `DynamicLayer`, which allow it to provide any number of sub-layers, each with a specific geometry type and in addition based on an OSM tag filter.
For example, you can have a layer providing all cycle paths as `LineStrings`, or a layer providing all lakes as `Polygons`.
Underneath these are all still backed by the same fully connected graph, but exposed dynamically as apparently separate geometry layers.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ After restarting the server, you should be able to use the following *procedure
[[table-all]]
[separator=¦,opts=header,cols="1m,4,4m"]
|===
¦ name ¦ description ¦ signature ¦ "spatial.addLayer" ¦ "Adds a new layer with the given type (see spatial.getAllLayerTypes) and configuration, returns the layer root node" ¦ "spatial.addLayer(name :: STRING?, type :: STRING?, encoderConfig :: STRING?) :: (node :: NODE?)"
¦ name ¦ description ¦ signature
¦ "spatial.addLayer" ¦ "Adds a new layer with the given type (see spatial.getAllLayerTypes) and configuration, returns the layer root node" ¦ "spatial.addLayer(name :: STRING?, type :: STRING?, encoderConfig :: STRING?) :: (node :: NODE?)"
¦ "spatial.addLayerWithEncoder" ¦ "Adds a new layer with the given encoder class and configuration, returns the layer root node" ¦ "spatial.addLayerWithEncoder(name :: STRING?, encoder :: STRING?, encoderConfig :: STRING?) :: (node :: NODE?)"
¦ "spatial.addNode" ¦ "Adds the given node to the layer, returns the geometry-node" ¦ "spatial.addNode(layerName :: STRING?, node :: NODE?) :: (node :: NODE?)"
¦ "spatial.addNodes" ¦ "Adds the given nodes list to the layer, returns the count" ¦ "spatial.addNodes(layerName :: STRING?, nodes :: LIST? OF NODE?) :: (count :: INTEGER?)"
Expand All @@ -25,10 +26,10 @@ After restarting the server, you should be able to use the following *procedure
¦ "spatial.closest" ¦ "Finds all geometry nodes in the layer within the distance to the given coordinate" ¦ "spatial.closest(layerName :: STRING?, coordinate :: ANY?, distanceInKm :: FLOAT?) :: (node :: NODE?)"
¦ "spatial.decodeGeometry" ¦ "Returns a geometry of a layer node as internal cypher geometry type, to be passed to other procedures but not returned to a client" ¦ "spatial.decodeGeometry(layerName :: STRING?, node :: NODE?) :: (geometry :: ANY?)"
¦ "spatial.getFeatureAttributes" ¦ "Returns feature attributes of the given layer" ¦ "spatial.getFeatureAttributes(name :: STRING?) :: (name :: STRING?)"
¦ "spatial.importOSM" ¦ "Imports the provided osm-file from URI to a layer of the same name, returns the count of data added" ¦ "spatial.importOSM(uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.importOSMToLayer" ¦ "Imports the provided osm-file from URI to a layer, returns the count of data added" ¦ "spatial.importOSMToLayer(layerName :: STRING?, uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.importShapefile" ¦ "Imports the provided shape-file from URI to a layer of the same name, returns the count of data added" ¦ "spatial.importShapefile(uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.importShapefileToLayer" ¦ "Imports the provided shape-file from URI to the given layer, returns the count of data added" ¦ "spatial.importShapefileToLayer(layerName :: STRING?, uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.importOSM" ¦ "Imports the provided osm-file from URI to a layer of the same name, returns the count of data added" ¦ "spatial.importOSM(uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.importOSMToLayer" ¦ "Imports the provided osm-file from URI to a layer, returns the count of data added" ¦ "spatial.importOSMToLayer(layerName :: STRING?, uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.importShapefile" ¦ "Imports the provided shape-file from URI to a layer of the same name, returns the count of data added" ¦ "spatial.importShapefile(uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.importShapefileToLayer" ¦ "Imports the provided shape-file from URI to the given layer, returns the count of data added" ¦ "spatial.importShapefileToLayer(layerName :: STRING?, uri :: STRING?) :: (count :: INTEGER?)"
¦ "spatial.intersects" ¦ "Returns all geometry nodes that intersect the given geometry (shape, polygon) in the layer" ¦ "spatial.intersects(layerName :: STRING?, geometry :: ANY?) :: (node :: NODE?)"
¦ "spatial.layer" ¦ "Returns the layer root node for the given layer name" ¦ "spatial.layer(name :: STRING?) :: (node :: NODE?)"
¦ "spatial.layerTypes" ¦ "Returns the different registered layer types" ¦ "spatial.layerTypes() :: (name :: STRING?, signature :: STRING?)"
Expand All @@ -40,10 +41,8 @@ After restarting the server, you should be able to use the following *procedure
¦ "spatial.withinDistance" ¦ "Returns all geometry nodes and their ordered distance in the layer within the distance to the given coordinate" ¦ "spatial.withinDistance(layerName :: STRING?, coordinate :: ANY?, distanceInKm :: FLOAT?) :: (node :: NODE?, distance :: FLOAT?)"
|===

////
[[table-all]]
[separator=¦,opts=header,cols="1m,4,4m"]
|===
include::../target/generated-documentation/org.neo4j.gis.spatial.procedures.csv[]
|===
////
// [[table-all]]
// [separator=¦,opts=header,cols="1m,4,4m"]
// |===
// include::../target/generated-documentation/org.neo4j.gis.spatial.procedures.csv[]
// |===
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// DO NOT MODIFY, THIS FILE IS AUTO GENERATED!
[[examples-affine-transformation]]
== Affine Transformation

This pipe applies an affine transformation to every geometry.

Example:

[source,java,indent=0]
----
include::example$GeoPipesDocTest.java[tags=s_affine_transformation]
----

Output:

image::generated/affine_transformation.png[]


Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// DO NOT MODIFY, THIS FILE IS AUTO GENERATED!
[[examples-boundary]]
== Boundary

The boundary pipe calculates boundary of every geometry in the pipeline.

Example:

[source,java,indent=0]
----
include::example$GeoPipesDocTest.java[tags=s_boundary]
----

Output:

image::generated/boundary.png[]


Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// DO NOT MODIFY, THIS FILE IS AUTO GENERATED!
[[examples-break-up-all-geometries-into-points-and-make-density-islands]]
== Break up all geometries into points and make density islands

This example demonstrates the some pipes chained together to make a full geoprocessing pipeline.

Example:

[source,java,indent=0]
----
include::example$GeoPipesDocTest.java[tags=s_break_up_all_geometries_into_points_and_make_density_islands]
----

Step 1 - startOsm:

image::generated/step1_break_up_all_geometries_into_points_and_make_density_islands.png[]

Step 2 - extractOsmPoints:

image::generated/step2_break_up_all_geometries_into_points_and_make_density_islands.png[]

Step 3 - groupByDensityIslands:

image::generated/step3_break_up_all_geometries_into_points_and_make_density_islands.png[]

Step 4 - toConvexHull:

image::generated/step4_break_up_all_geometries_into_points_and_make_density_islands.png[]

Step 5- toBuffer:

image::generated/step5_break_up_all_geometries_into_points_and_make_density_islands.png[]


Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// DO NOT MODIFY, THIS FILE IS AUTO GENERATED!
[[examples-buffer]]
== Buffer

This pipe applies a buffer to geometries.

Example:

[source,java,indent=0]
----
include::example$GeoPipesDocTest.java[tags=s_buffer]
----

Output:

image::generated/buffer.png[]


Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// DO NOT MODIFY, THIS FILE IS AUTO GENERATED!
[[examples-centroid]]
== Centroid

This pipe calculates geometry centroid.

Example:

[source,java,indent=0]
----
include::example$GeoPipesDocTest.java[tags=s_centroid]
----

Output:

image::generated/centroid.png[]


Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// DO NOT MODIFY, THIS FILE IS AUTO GENERATED!
[[examples-convex-hull]]
== Convex Hull

This pipe calculates geometry convex hull.

Example:

[source,java,indent=0]
----
include::example$GeoPipesDocTest.java[tags=s_convex_hull]
----

Output:

image::generated/convex_hull.png[]


Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// DO NOT MODIFY, THIS FILE IS AUTO GENERATED!
[[examples-densify]]
== Densify

This pipe inserts extra vertices along the line segments in the geometry.
The densified geometry contains no line segment which is longer than the given distance tolerance.

Example:

[source,java,indent=0]
----
include::example$GeoPipesDocTest.java[tags=s_densify]
----

Output:

image::generated/densify.png[]


Loading

0 comments on commit 5c86123

Please sign in to comment.