Skip to content

Commit

Permalink
Fixing the pull request as per the comments of @daniel-j-h
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanmarkov committed Oct 5, 2015
1 parent 4d29573 commit 9d7d965
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions extractor/extraction_containers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,18 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
++edge_iterator;
}

// Fixed: all edges left after the loop are invalid
// This happens when smaller area is cut through the streets with
// osmosis.
while (edge_iterator != all_edges_list_end)
// Remove all remaining edges. They are invalid because there are no corresponding nodes for
// them. This happens when using osmosis with bbox or polygon to extract smaller areas.
if (0 < std::distance(edge_iterator, all_edges_list_end))
{
SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference " << edge_iterator->result.source;
edge_iterator->result.source = SPECIAL_NODEID;
++edge_iterator;
SimpleLogger().Write(LogLevel::logWARNING) << "Ignoring multiple invalid edges. Please "
"check your OSM file for dangling "
"references.";
auto markSourcesInvalid = [](InternalExtractorEdge &edge)
{
edge.result.source = SPECIAL_NODEID;
};
std::for_each(edge_iterator, all_edges_list_end, markSourcesInvalid);
}
TIMER_STOP(set_start_coords);
std::cout << "ok, after " << TIMER_SEC(set_start_coords) << "s" << std::endl;
Expand Down Expand Up @@ -358,14 +362,18 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
++edge_iterator;
}

// Fixed: all edges left after the loop are invalid
// This happens when smaller area is cut through the streets with
// osmosis
while (edge_iterator != all_edges_list_end_)
// Remove all remaining edges. They are invalid because there are no corresponding nodes for
// them. This happens when using osmosis with bbox or polygon to extract smaller areas.
if (0 < std::distance(edge_iterator, all_edges_list_end_))
{
SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference " << edge_iterator->result.source;
edge_iterator->result.target = SPECIAL_NODEID;
++edge_iterator;
SimpleLogger().Write(LogLevel::logWARNING) << "Ignoring multiple invalid edges. Please "
"check your OSM file for dangling "
"references.";
auto markTargetsInvalid = [](InternalExtractorEdge &edge)
{
edge.result.target = SPECIAL_NODEID;
};
std::for_each(edge_iterator, all_edges_list_end_, markTargetsInvalid);
}
TIMER_STOP(compute_weights);
std::cout << "ok, after " << TIMER_SEC(compute_weights) << "s" << std::endl;
Expand Down

0 comments on commit 9d7d965

Please sign in to comment.