Skip to content

Commit c1ad275

Browse files
committed
Empty CSV entries (nodeA,nodeA) can be treated as non-fatal as long as we don't try to update any matching artificial segments.
1 parent 6bae070 commit c1ad275

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/updater/csv_source.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ SegmentLookupTable readSegmentValues(const std::vector<std::string> &paths)
4444
});
4545
if (found_inconsistency != std::end(result.lookup))
4646
{
47-
throw util::exception("empty segment in CSV with node " +
48-
std::to_string(found_inconsistency->first.from) + " " + SOURCE_REF);
47+
util::Log(logWARNING) << "Empty segment in CSV with node " +
48+
std::to_string(found_inconsistency->first.from);
4949
}
5050

5151
return result;

src/updater/updater.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ updateSegmentData(const UpdaterConfig &config,
221221
{
222222
auto u = osm_node_ids[nodes_range[segment_offset]];
223223
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
224+
225+
// Self-loops are artifical segments (e.g. traffic light nodes), do not
226+
// waste time updating them with traffic data
227+
if (u == v)
228+
continue;
229+
224230
if (auto value = segment_speed_lookup({u, v}))
225231
{
226232
auto segment_length = segment_lengths[segment_offset];
@@ -254,6 +260,12 @@ updateSegmentData(const UpdaterConfig &config,
254260
{
255261
auto u = osm_node_ids[nodes_range[segment_offset]];
256262
auto v = osm_node_ids[nodes_range[segment_offset + 1]];
263+
264+
// Self-loops are artifical segments (e.g. traffic light nodes), do not
265+
// waste time updating them with traffic data
266+
if (u == v)
267+
continue;
268+
257269
if (auto value = segment_speed_lookup({v, u}))
258270
{
259271
auto segment_length = segment_lengths[segment_offset];

0 commit comments

Comments
 (0)