Skip to content

Commit 2cf9571

Browse files
Support floats for speed value in traffic updates CSV (#6327)
1 parent b17cbb4 commit 2cf9571

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
continue-on-error: false
2727
steps:
2828
- uses: actions/checkout@v3
29-
- run: pip install conan==1.50.0
29+
- run: pip install conan==1.51.3
3030
- run: conan --version
3131
- run: cmake --version
3232
- uses: actions/setup-node@v3

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- NodeJS:
1010
- FIXED: Support `skip_waypoints` in Node bindings [#6060](https://github.com/Project-OSRM/osrm-backend/pull/6060)
1111
- Misc:
12+
- ADDED: Support floats for speed value in traffic updates CSV. [#6327](https://github.com/Project-OSRM/osrm-backend/pull/6327)
1213
- CHANGED: Use Lua 5.4 in Docker image. [#6346](https://github.com/Project-OSRM/osrm-backend/pull/6346)
1314
- CHANGED: Remove redundant nullptr check. [#6326](https://github.com/Project-OSRM/osrm-backend/pull/6326)
1415
- CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360)

features/testbot/weight.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Feature: Weight tests
329329
| ce |
330330
And the speed file
331331
"""
332-
1,2,36,42
332+
1,2,36.999,42
333333
2,1,36,42
334334
"""
335335
And the turn penalty file
@@ -341,8 +341,8 @@ Feature: Weight tests
341341

342342
When I route I should get
343343
| waypoints | route | distance | weights | times |
344-
| a,d | , | 60m | 20.5,0 | 24s,0s |
345-
| a,e | ,, | 60m | 27.2,10,0 | 38.5s,11s,0s |
344+
| a,d | , | 60m | 20.5,0 | 23.9s,0s |
345+
| a,e | ,, | 60m | 27.2,10,0 | 38.4s,11s,0s |
346346
| d,e | ,, | 40m | 10,10,0 | 11s,11s,0s |
347347

348348
@traffic @speed

include/updater/source.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ struct Segment final
4949

5050
struct SpeedSource final
5151
{
52-
SpeedSource() : speed(0), rate() {}
53-
unsigned speed;
52+
SpeedSource() : speed(0.), rate() {}
53+
double speed;
5454
boost::optional<double> rate;
5555
std::uint8_t source;
5656
};

src/updater/csv_source.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ namespace csv
3434
SegmentLookupTable readSegmentValues(const std::vector<std::string> &paths)
3535
{
3636
static const auto value_if_blank = std::numeric_limits<double>::quiet_NaN();
37+
const qi::real_parser<double, qi::ureal_policies<double>> unsigned_double;
3738
CSVFilesParser<Segment, SpeedSource> parser(
3839
1,
3940
qi::ulong_long >> ',' >> qi::ulong_long,
40-
qi::uint_ >> -(',' >> (qi::double_ | qi::attr(value_if_blank))));
41+
unsigned_double >> -(',' >> (qi::double_ | qi::attr(value_if_blank))));
4142

4243
// Check consistency of keys in the result lookup table
4344
auto result = parser(paths);

0 commit comments

Comments
 (0)