spatial
spatial copied to clipboard
Experimental feature to merge multiple OSM layers together
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
OSMNodenodes inother- for each check if there is a matching node inmainand 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
OSMWaynodes inother- for each check if there is a matching node inmainand 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
OSMRelationtoo - If re-indexing is required, remove all
mainnodes from the RTree index and run re-indexing
- iterate over all