spatial icon indicating copy to clipboard operation
spatial copied to clipboard

Experimental feature to merge multiple OSM layers together

Open craigtaverner opened this issue 4 years ago • 1 comments

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

craigtaverner avatar Apr 19 '21 12:04 craigtaverner