Neo4j Spatial is a library of utilities for Neo4j that faciliates 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.
This PR introduces a new feature allowing users to configure spatial indexes in Neo4j Spatial. Previously, it was not possible to index the same Node with two separate indexes. This update addresses that limitation by introducing customizable index configurations, including a new referenceRelationshipType option.
Key Changes:
Index Configuration Options:
Added support for custom configuration of spatial indexes.
Users can now specify all the config parameters available for an index
Add referenceRelationshipType as config parameter to the pRTreeIndex
Code Enhancements:
Modified index creation logic to incorporate configuration options.
Ensured backward compatibility with default configurations.
Tests and Validation:
Added unit tests for the new configuration options.
Ensured all existing tests pass.
Usage:
// create 1st index
CALL spatial.addLayer('point1','NativePoint','point1:point1BB', '{"referenceRelationshipType": "RTREE_P1_TYPE"}')
// create 2nd index
CALL spatial.addLayer('point2','NativePoint','point2:point2BB', '{"referenceRelationshipType": "RTREE_P2_TYPE"}')
Now you can add the same Node to both indexes:
UNWIND range(1,$count) as i
CREATE (n:Point {
id: i,
point1: point( { latitude: 56.0, longitude: 12.0 } ),
point2: point( { latitude: 57.0, longitude: 13.0 } )
})
MATCH (p:Point)
WITH (count(p) / 10) AS pages, collect(p) AS nodes
UNWIND range(0, pages) AS i CALL {
WITH i, nodes
CALL spatial.addNodes('point1', nodes[(i * 10)..((i + 1) * 10)]) YIELD count
RETURN count AS count
} IN TRANSACTIONS OF 1 ROWS
RETURN sum(count) AS count
MATCH (p:Point)
WITH (count(p) / 10) AS pages, collect(p) AS nodes
UNWIND range(0, pages) AS i CALL {
WITH i, nodes
CALL spatial.addNodes('point2', nodes[(i * 10)..((i + 1) * 10)]) YIELD count
RETURN count AS count
} IN TRANSACTIONS OF 1 ROWS
RETURN sum(count) AS count
Overview
This PR introduces a new feature allowing users to configure spatial indexes in Neo4j Spatial. Previously, it was not possible to index the same Node with two separate indexes. This update addresses that limitation by introducing customizable index configurations, including a new referenceRelationshipType option.
Key Changes:
Index Configuration Options:
referenceRelationshipType
as config parameter to the pRTreeIndex
Code Enhancements:
Tests and Validation:
Usage:
Now you can add the same Node to both indexes: