Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
- Changes from 6.0.0
- Routing:
- FIXED: Crash when route starts or ends at `type=manoeuvre` relation via node [#7287](https://github.com/Project-OSRM/osrm-backend/issues/7287)
- Extraction:
- ADDED: Emit warning when ways reference nodes not present in input data [#1596](https://github.com/Project-OSRM/osrm-backend/issues/1596)
- Profiles:
- ADDED: Make `max_collapse_distance` configurable via Lua profiles to preserve short road crossings in pedestrian routing [#6171](https://github.com/Project-OSRM/osrm-backend/issues/6171)
- CHANGED: Apply configurable penalty (default 60s) to gates in car profile [#6757](https://github.com/Project-OSRM/osrm-backend/issues/6757)
Expand Down
19 changes: 19 additions & 0 deletions features/options/extract/missing_nodes.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@extract @options @missing_nodes
Feature: osrm-extract - Missing node references

Background:
Given the profile "testbot"

Scenario: osrm-extract - Warn about missing node references
Given the node map
"""
a b c
"""
And the ways
| nodes |
| abc |
And node "b" is removed from OSM data
And the data has been saved to disk
When I try to run "osrm-extract {osm_file} --profile {profile_file}"
Then it should exit with an error
And stderr should contain "referenced by ways were not found"
7 changes: 7 additions & 0 deletions features/step_definitions/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ Given(
},
);

Given(/^node "([a-z])" is removed from OSM data$/, function (name, callback) {
const node = this.findNodeByName(name);
if (!node) throw new Error(`*** unknown node ${name}`);
this.OSMDB.nodes = this.OSMDB.nodes.filter((n) => n.id !== node.id);
callback();
});

Given(/^the data has been saved to disk$/, function (callback) {
this.writeOSM();
callback();
Expand Down
8 changes: 8 additions & 0 deletions src/extractor/extraction_containers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ void ExtractionContainers::PrepareNodes()
util::UnbufferedLog log;
log << "Building node id map ... " << std::flush;
TIMER_START(id_map);
const auto original_used_count = used_node_id_list.size();
auto node_iter = all_nodes_list.begin();
auto ref_iter = used_node_id_list.begin();
auto used_nodes_iter = used_node_id_list.begin();
Expand Down Expand Up @@ -500,6 +501,13 @@ void ExtractionContainers::PrepareNodes()

// Remove unused nodes and check maximal internal node id
used_node_id_list.resize(std::distance(used_node_id_list.begin(), used_nodes_iter));
const auto dropped_count = original_used_count - used_node_id_list.size();
if (dropped_count > 0)
{
util::Log(logWARNING) << dropped_count
<< " node(s) referenced by ways were not found in the input data"
" and will be ignored";
}
if (used_node_id_list.size() > std::numeric_limits<NodeID>::max())
{
throw util::exception("There are too many nodes remaining after filtering, OSRM only "
Expand Down
Loading