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.
The idea here is that if we have imported multiple overlapping chunks of OSM data, it should be possible to stitch them together. The process does as follows:
Identify the two layers (two OSM models), with one designated as the layer to merge into. The other layer will be removed from the index.
Call spatial.merge.into(main,other)
This will perform the following steps:
iterate over all OSMNode nodes in other - for each check if there is a matching node in main and update to other properties (if the node moves, record that fact for re-indexing). If there is no matching node, re-label the node to the new layer (moving it in internal indexes). All nodes with geometry nodes attached are recorded for later re-indexing
iterate over all OSMWay nodes in other - for each check if there is a matching node in main and if not move the layer by re-labeling. If there is a matching way, then do a node level merge by finding common nodes and re-sorting.
repeat this process for OSMRelation too
If re-indexing is required, remove all main nodes from the RTree index and run re-indexing
The idea here is that if we have imported multiple overlapping chunks of OSM data, it should be possible to stitch them together. The process does as follows:
spatial.merge.into(main,other)
OSMNode
nodes inother
- for each check if there is a matching node inmain
and update to other properties (if the node moves, record that fact for re-indexing). If there is no matching node, re-label the node to the new layer (moving it in internal indexes). All nodes with geometry nodes attached are recorded for later re-indexingOSMWay
nodes inother
- for each check if there is a matching node inmain
and if not move the layer by re-labeling. If there is a matching way, then do a node level merge by finding common nodes and re-sorting.OSMRelation
toomain
nodes from the RTree index and run re-indexing