Support floats for speed value in traffic updates CSV

This commit is contained in:
Siarhei Fedartsou 2022-08-24 18:11:21 +02:00
parent a98074a051
commit b907885a09
4 changed files with 7 additions and 6 deletions

View File

@ -7,6 +7,7 @@
- NodeJS: - NodeJS:
- FIXED: Support `skip_waypoints` in Node bindings [#6060](https://github.com/Project-OSRM/osrm-backend/pull/6060) - FIXED: Support `skip_waypoints` in Node bindings [#6060](https://github.com/Project-OSRM/osrm-backend/pull/6060)
- Misc: - Misc:
- ADDED: Support floats for speed value in traffic updates CSV. [#6327](https://github.com/Project-OSRM/osrm-backend/pull/6327)
- CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360) - CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360)
- CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [#6318](https://github.com/Project-OSRM/osrm-backend/pull/6318) - CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [#6318](https://github.com/Project-OSRM/osrm-backend/pull/6318)
- FIXED: Fix distance calculation consistency. [#6315](https://github.com/Project-OSRM/osrm-backend/pull/6315) - FIXED: Fix distance calculation consistency. [#6315](https://github.com/Project-OSRM/osrm-backend/pull/6315)

View File

@ -329,7 +329,7 @@ Feature: Weight tests
| ce | | ce |
And the speed file And the speed file
""" """
1,2,36,42 1,2,36.999,42
2,1,36,42 2,1,36,42
""" """
And the turn penalty file And the turn penalty file
@ -341,8 +341,8 @@ Feature: Weight tests
When I route I should get When I route I should get
| waypoints | route | distance | weights | times | | waypoints | route | distance | weights | times |
| a,d | , | 60m | 20.5,0 | 24s,0s | | a,d | , | 60m | 20.5,0 | 23.9s,0s |
| a,e | ,, | 60m | 27.2,10,0 | 38.5s,11s,0s | | a,e | ,, | 60m | 27.2,10,0 | 38.4s,11s,0s |
| d,e | ,, | 40m | 10,10,0 | 11s,11s,0s | | d,e | ,, | 40m | 10,10,0 | 11s,11s,0s |
@traffic @speed @traffic @speed

View File

@ -49,8 +49,8 @@ struct Segment final
struct SpeedSource final struct SpeedSource final
{ {
SpeedSource() : speed(0), rate() {} SpeedSource() : speed(0.), rate() {}
unsigned speed; double speed;
boost::optional<double> rate; boost::optional<double> rate;
std::uint8_t source; std::uint8_t source;
}; };

View File

@ -37,7 +37,7 @@ SegmentLookupTable readSegmentValues(const std::vector<std::string> &paths)
CSVFilesParser<Segment, SpeedSource> parser( CSVFilesParser<Segment, SpeedSource> parser(
1, 1,
qi::ulong_long >> ',' >> qi::ulong_long, qi::ulong_long >> ',' >> qi::ulong_long,
qi::uint_ >> -(',' >> (qi::double_ | qi::attr(value_if_blank)))); qi::double_ >> -(',' >> (qi::double_ | qi::attr(value_if_blank))));
// Check consistency of keys in the result lookup table // Check consistency of keys in the result lookup table
auto result = parser(paths); auto result = parser(paths);