Skip to content

Commit

Permalink
Vgi 2511 crossing way snapping (#5480)
Browse files Browse the repository at this point in the history
* Update crossing way snapping algorithm with input from the tradecraft group. DON'T snap to old nodes, create new ones at crossing. BUT STILL avoid duplicates.

* Patch tests after algorithm change

* Patch tests after algorithm change

* Patch more tests
  • Loading branch information
mschicker committed Nov 1, 2022
1 parent 74fa395 commit dae66ca
Show file tree
Hide file tree
Showing 15 changed files with 13,037 additions and 12,836 deletions.
12 changes: 9 additions & 3 deletions hoot-core/src/main/cpp/hoot/core/ops/UnconnectedWaySnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ void UnconnectedWaySnapper::apply(OsmMapPtr& map)
// Ensure the way has the status we require for snapping.
if (_wayToSnapCrit->isSatisfied(wayToSnap))
{
_snapUnconnectedWayCrossings(wayToSnap);
_snapUnconnectedWayEndNodes(wayToSnap);
_snapUnconnectedWayCrossings(wayToSnap);
}

waysProcessed++;
Expand Down Expand Up @@ -607,7 +607,13 @@ void UnconnectedWaySnapper::_snapUnconnectedWayCrossings(const WayPtr& wayToSnap
bool makeNewNode = true;
// Do we have node(s) here?
geos::geom::Envelope nodeEnv(seq->getAt(i));
nodeEnv.expandBy(_maxSnapDistance);

// Used to be _maxSnapDistance
// But that caused unwanted map perturbations
// We want to re-use super-close nodes, AND de-dupe nodes, so we keep this code,
// but use a small envelope.
const double tenCentimeters = 0.10;
nodeEnv.expandBy(tenCentimeters);
std::set<ElementId> neighborIds = SpatialIndexer::findNeighbors(nodeEnv, _crossingWayNodeIndex, _crossingWayNodeIndexToEid, _map, ElementType::Node);
if (1 == neighborIds.size())
{
Expand Down Expand Up @@ -653,7 +659,7 @@ void UnconnectedWaySnapper::_snapUnconnectedWayCrossings(const WayPtr& wayToSnap
else
{ // Remove dupe node
// crashes // testWay->removeNode(oldNodeId);
RemoveNodeByEid::removeNode(_map, oldNodeId, true);
RemoveNodeByEid::removeNodeFully(_map, oldNodeId);
LOG_DEBUG(QString("Orphaned old node %1").arg(oldNodeId));
}
}
Expand Down
Loading

0 comments on commit dae66ca

Please sign in to comment.