Empty CSV entries (nodeA,nodeA) can be treated as non-fatal as long as we don't try to update any matching artificial segments.

This commit is contained in:
Daniel Patterson 2017-08-16 11:53:21 -07:00
parent 6bae070091
commit c1ad275e71
2 changed files with 14 additions and 2 deletions

View File

@ -44,8 +44,8 @@ SegmentLookupTable readSegmentValues(const std::vector<std::string> &paths)
});
if (found_inconsistency != std::end(result.lookup))
{
throw util::exception("empty segment in CSV with node " +
std::to_string(found_inconsistency->first.from) + " " + SOURCE_REF);
util::Log(logWARNING) << "Empty segment in CSV with node " +
std::to_string(found_inconsistency->first.from);
}
return result;

View File

@ -221,6 +221,12 @@ updateSegmentData(const UpdaterConfig &config,
{
auto u = osm_node_ids[nodes_range[segment_offset]];
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
// Self-loops are artifical segments (e.g. traffic light nodes), do not
// waste time updating them with traffic data
if (u == v)
continue;
if (auto value = segment_speed_lookup({u, v}))
{
auto segment_length = segment_lengths[segment_offset];
@ -254,6 +260,12 @@ updateSegmentData(const UpdaterConfig &config,
{
auto u = osm_node_ids[nodes_range[segment_offset]];
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
// Self-loops are artifical segments (e.g. traffic light nodes), do not
// waste time updating them with traffic data
if (u == v)
continue;
if (auto value = segment_speed_lookup({v, u}))
{
auto segment_length = segment_lengths[segment_offset];