Use round for float to fixed coordinate transformations

This commit is contained in:
Michael Krasnyk 2017-01-17 17:17:47 +01:00 committed by Patrick Niklaus
parent c03aa8a273
commit e8167b2e4e
22 changed files with 179 additions and 178 deletions

View File

@ -64,6 +64,6 @@ Feature: Bike - Handle ferry routes
| abcd | | ferry | yes | 1:00 | | abcd | | ferry | yes | 1:00 |
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | d | abcd,abcd | 3600s +-10 | | a | d | abcd,abcd | 3600s |
| d | a | abcd,abcd | 3600s +-10 | | d | a | abcd,abcd | 3600s |

View File

@ -7,15 +7,15 @@ Feature: Bike - Max speed restrictions
Scenario: Bicycle - Respect maxspeeds when lower that way type speed Scenario: Bicycle - Respect maxspeeds when lower that way type speed
Then routability should be Then routability should be
| highway | maxspeed | bothw | | highway | maxspeed | bothw |
| residential | | 15 km/h +- 1 | | residential | | 15 km/h |
| residential | 10 | 10 km/h +- 1 | | residential | 10 | 9 km/h |
Scenario: Bicycle - Ignore maxspeed when higher than way speed Scenario: Bicycle - Ignore maxspeed when higher than way speed
Then routability should be Then routability should be
| highway | maxspeed | bothw | | highway | maxspeed | bothw |
| residential | | 15 km/h +- 1 | | residential | | 15 km/h |
| residential | 80 | 15 km/h | | residential | 80 | 15 km/h |
@todo @todo
Scenario: Bicycle - Maxspeed formats Scenario: Bicycle - Maxspeed formats
@ -63,14 +63,14 @@ Feature: Bike - Max speed restrictions
| snail | 720s ~10% | | snail | 720s ~10% |
Then routability should be Then routability should be
| maxspeed | maxspeed:forward | maxspeed:backward | forw | backw | | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
| | | | 15 km/h +- 1 | 15 km/h +- 1 | | | | | 15 km/h | 15 km/h |
| 10 | | | 10 km/h +- 1 | 10 km/h +- 1 | | 10 | | | 9 km/h | 9 km/h |
| | 10 | | 10 km/h +- 1 | 15 km/h +- 1 | | | 10 | | 9 km/h | 15 km/h |
| | | 10 | 15 km/h | 10 km/h +- 1 | | | | 10 | 14 km/h | 9 km/h |
| 2 | 10 | | 10 km/h +- 1 | 2 km/h | | 2 | 10 | | 9 km/h | 2 km/h |
| 2 | | 10 | 2 km/h | 10 km/h +- 1 | | 2 | | 10 | 2 km/h | 9 km/h |
| 2 | 5 | 10 | 5 km/h | 10 km/h +- 1 | | 2 | 5 | 10 | 5 km/h | 9 km/h |
Scenario: Bike - Maxspeed should not allow routing on unroutable ways Scenario: Bike - Maxspeed should not allow routing on unroutable ways
Then routability should be Then routability should be

View File

@ -6,27 +6,27 @@ Feature: Bike - Surfaces
Scenario: Bicycle - Slow surfaces Scenario: Bicycle - Slow surfaces
Then routability should be Then routability should be
| highway | surface | bothw | | highway | surface | bothw |
| cycleway | | 48 s | | cycleway | | 48 s |
| cycleway | asphalt | 47.9 s| | cycleway | asphalt | 48 s |
| cycleway | cobblestone:flattened | 72 s | | cycleway | cobblestone:flattened | 72 s |
| cycleway | paving_stones | 72 s | | cycleway | paving_stones | 72 s |
| cycleway | compacted | 72 s | | cycleway | compacted | 72 s |
| cycleway | cobblestone | 120 s | | cycleway | cobblestone | 120 s |
| cycleway | fine_gravel | 120 s | | cycleway | fine_gravel | 120 s |
| cycleway | gravel | 120 s | | cycleway | gravel | 120 s |
| cycleway | pebblestone | 120 s | | cycleway | pebblestone | 120.1 s |
| cycleway | dirt | 120 s | | cycleway | dirt | 120 s |
| cycleway | earth | 120 s | | cycleway | earth | 120 s |
| cycleway | grass | 120 s | | cycleway | grass | 120 s |
| cycleway | mud | 240 s | | cycleway | mud | 240 s |
| cycleway | sand | 240 s | | cycleway | sand | 240.1 s |
Scenario: Bicycle - Good surfaces on small paths Scenario: Bicycle - Good surfaces on small paths
Then routability should be Then routability should be
| highway | surface | bothw | | highway | surface | bothw |
| cycleway | | 48 s | | cycleway | | 48 s |
| path | | 59.9 s| | path | | 60 s |
| track | | 60 s | | track | | 60 s |
| track | asphalt | 60 s | | track | asphalt | 60 s |
| path | asphalt | 60 s | | path | asphalt | 60 s |

View File

@ -55,8 +55,8 @@ OSRM will use 4/5 of the projected free-flow speed.
| highway | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw | | highway | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
| primary | | | | 52 km/h | 52 km/h | | primary | | | | 52 km/h | 52 km/h |
| primary | 60 | | | 48 km/h | 48 km/h | | primary | 60 | | | 48 km/h | 48 km/h |
| primary | | 60 | | 48 km/h | 48 km/h +- 5 | | primary | | 60 | | 48 km/h | 52 km/h |
| primary | | | 60 | 52 km/h | 52 km/h +- 5 | | primary | | | 60 | 52 km/h | 48 km/h |
| primary | 15 | 60 | | 48 km/h | 12 km/h | | primary | 15 | 60 | | 48 km/h | 12 km/h |
| primary | 15 | | 60 | 12 km/h | 48 km/h | | primary | 15 | | 60 | 12 km/h | 48 km/h |
| primary | 15 | 30 | 60 | 24 km/h | 48 km/h | | primary | 15 | 30 | 60 | 24 km/h | 48 km/h |
@ -91,11 +91,11 @@ OSRM will use 4/5 of the projected free-flow speed.
| primary | | | | 60 | 52 km/h | 47 km/h | | primary | | | | 60 | 52 km/h | 47 km/h |
| primary | | 3 | | 60 | 32 km/h | 29 km/h | | primary | | 3 | | 60 | 32 km/h | 29 km/h |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | | primary | 15 | | 60 | | 47 km/h | 11 km/h |
| primary | 15 | 3 | 60 | | 29 km/h | 7 km/h | | primary | 15 | 3 | 60 | | 30 km/h | 7 km/h |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | | primary | 15 | | | 60 | 12 km/h | 47 km/h |
| primary | 15 | 3 | | 60 | 7 km/h | 29 km/h | | primary | 15 | 3 | | 60 | 7 km/h | 29 km/h |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h |
| primary | 15 | 3 | 30 | 60 | 14 km/h | 29 km/h | | primary | 15 | 3 | 30 | 60 | 15 km/h | 29 km/h |
Scenario: Car - Single lane streets be ignored or incur a penalty Scenario: Car - Single lane streets be ignored or incur a penalty
Then routability should be Then routability should be
@ -110,11 +110,11 @@ OSRM will use 4/5 of the projected free-flow speed.
| primary | | | | 60 | 52 km/h | 47 km/h | | primary | | | | 60 | 52 km/h | 47 km/h |
| primary | | 1 | | 60 | 32 km/h | 29 km/h | | primary | | 1 | | 60 | 32 km/h | 29 km/h |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | | primary | 15 | | 60 | | 47 km/h | 11 km/h |
| primary | 15 | 1 | 60 | | 29 km/h | 7 km/h | | primary | 15 | 1 | 60 | | 30 km/h | 7 km/h |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | | primary | 15 | | | 60 | 12 km/h | 47 km/h |
| primary | 15 | 1 | | 60 | 7 km/h | 29 km/h | | primary | 15 | 1 | | 60 | 7 km/h | 29 km/h |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h |
| primary | 15 | 1 | 30 | 60 | 14 km/h | 29 km/h | | primary | 15 | 1 | 30 | 60 | 15 km/h | 29 km/h |
Scenario: Car - Single lane streets only incure a penalty for two-way streets Scenario: Car - Single lane streets only incure a penalty for two-way streets
Then routability should be Then routability should be
@ -131,6 +131,5 @@ OSRM will use 4/5 of the projected free-flow speed.
| primary | 30 | | | -1 | | 23 km/h | | primary | 30 | | | -1 | | 23 km/h |
| primary | | 30 | | -1 | | 52 km/h | | primary | | 30 | | -1 | | 52 km/h |
| primary | | | 30 | -1 | | 23 km/h | | primary | | | 30 | -1 | | 23 km/h |
| primary | 20 | 30 | | -1 | | 16 km/h | | primary | 20 | 30 | | -1 | | 15 km/h |
| primary | 20 | | 30 | -1 | | 23 km/h | | primary | 20 | | 30 | -1 | | 23 km/h |

View File

@ -9,7 +9,7 @@ Feature: Car - speeds
Then routability should be Then routability should be
| highway | oneway | bothw | | highway | oneway | bothw |
| motorway | no | 71 km/h | | motorway | no | 71 km/h |
| motorway_link | no | 36 km/h | | motorway_link | no | 35 km/h |
| trunk | no | 68 km/h | | trunk | no | 68 km/h |
| trunk_link | no | 31 km/h | | trunk_link | no | 31 km/h |
| primary | no | 52 km/h | | primary | no | 52 km/h |
@ -21,17 +21,17 @@ Feature: Car - speeds
| unclassified | no | 19 km/h | | unclassified | no | 19 km/h |
| residential | no | 19 km/h | | residential | no | 19 km/h |
| living_street | no | 8 km/h | | living_street | no | 8 km/h |
| service | no | 11 km/h | | service | no | 12 km/h |
# Alternating oneways have to take average waiting time into account. # Alternating oneways have to take average waiting time into account.
Scenario: Car - scaled speeds for oneway=alternating Scenario: Car - scaled speeds for oneway=alternating
Then routability should be Then routability should be
| highway | oneway | junction | forw | backw | # | | highway | oneway | junction | forw | backw | # |
| tertiary | | | 31 km/h | 31 km/h | | | tertiary | | | 31 km/h | 31 km/h | |
| tertiary | alternating | | 12 km/h +- 1 | 12 km/h +- 1 | | | tertiary | alternating | | 12 km/h | 12 km/h | |
| motorway | | | 71 km/h | | implied oneway | | motorway | | | 71 km/h | | implied oneway |
| motorway | alternating | | 28 km/h +- 1 | | implied oneway | | motorway | alternating | | 28 km/h | | implied oneway |
| motorway | reversible | | | | unroutable | | motorway | reversible | | | | unroutable |
| primary | | roundabout | 52 km/h | | implied oneway | | primary | | roundabout | 52 km/h | | implied oneway |
| primary | alternating | roundabout | 20 km/h +- 1 | | implied oneway | | primary | alternating | roundabout | 20 km/h | | implied oneway |
| primary | reversible | roundabout | | | unroutable | | primary | reversible | roundabout | | | unroutable |

View File

@ -64,6 +64,6 @@ Feature: Foot - Handle ferry routes
| abcd | | ferry | yes | 1:00 | | abcd | | ferry | yes | 1:00 |
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | d | abcd,abcd | 3600s +-10 | | a | d | abcd,abcd | 3600s |
| d | a | abcd,abcd | 3600s +-10 | | d | a | abcd,abcd | 3600s |

View File

@ -105,7 +105,7 @@ Feature: Staggered Intersections
j j
a b c a b c
d d
e f g e f g
h h
""" """

View File

@ -1358,7 +1358,7 @@ Feature: Simple Turns
| |
| |
| |
g a - - -b ga - - -b
f / f /
d -c d -c
""" """

View File

@ -37,13 +37,13 @@ Feature: Bearing parameter
| bc | | bc |
When I route I should get When I route I should get
| from | to | bearings | route | bearing | | from | to | bearings | route | bearing |
| 0 | c | 0 0 | | | | 0 | c | 0 0 | | |
| 0 | c | 45 45 | bc,bc | 0->44,44->0 +- 1 | | 0 | c | 45 45 | bc,bc | 0->45,45->0 |
| 0 | c | 85 85 | | | | 0 | c | 85 85 | | |
| 0 | c | 95 95 | | | | 0 | c | 95 95 | | |
| 0 | c | 135 135 | ac,ac | 0->135,135->0 +- 1| | 0 | c | 135 135 | ac,ac | 0->135,135->0 |
| 0 | c | 180 180 | | | | 0 | c | 180 180 | | |
Scenario: Testbot - Initial bearing on split way Scenario: Testbot - Initial bearing on split way
Given the node map Given the node map

View File

@ -20,5 +20,5 @@ Feature: Geometry Compression
When I route I should get When I route I should get
| from | to | route | distance | speed | | from | to | route | distance | speed |
| b | e | abcdef,abcdef | 588.6m | 36 km/h | | b | e | abcdef,abcdef | 588.5m | 36 km/h |
| e | b | abcdef,abcdef | 588.6m | 36 km/h | | e | b | abcdef,abcdef | 588.5m | 36 km/h |

View File

@ -16,8 +16,8 @@ Feature: Distance calculation
| ab | | ab |
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | b | ab,ab | 100m +- 2 | | a | b | ab,ab | 100m |
Scenario: Distance should equal sum of segments, leftwinded Scenario: Distance should equal sum of segments, leftwinded
Given the node map Given the node map
@ -33,7 +33,7 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | d | abcde,abcde | 300m +-2 | | a | d | abcde,abcde | 300m +-1 |
Scenario: Distance should equal sum of segments, rightwinded Scenario: Distance should equal sum of segments, rightwinded
Given the node map Given the node map
@ -49,7 +49,7 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | d | abcde,abcde | 300m +-2 | | a | d | abcde,abcde | 300m +-1 |
Scenario: 10m distances Scenario: 10m distances
Given a grid size of 10 meters Given a grid size of 10 meters
@ -65,12 +65,12 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | b | abc,abc | 10m +-2 | | a | b | abc,abc | 10m |
| b | a | abc,abc | 10m +-2 | | b | a | abc,abc | 10m |
| b | c | abc,abc | 10m +-2 | | b | c | abc,abc | 10m |
| c | b | abc,abc | 10m +-2 | | c | b | abc,abc | 10m |
| a | c | abc,abc | 20m +-4 | | a | c | abc,abc | 20m |
| c | a | abc,abc | 20m +-4 | | c | a | abc,abc | 20m |
Scenario: 100m distances Scenario: 100m distances
Given a grid size of 100 meters Given a grid size of 100 meters
@ -86,12 +86,12 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | b | abc,abc | 100m +-2 | | a | b | abc,abc | 100m |
| b | a | abc,abc | 100m +-2 | | b | a | abc,abc | 100m |
| b | c | abc,abc | 100m +-2 | | b | c | abc,abc | 100m |
| c | b | abc,abc | 100m +-2 | | c | b | abc,abc | 100m |
| a | c | abc,abc | 200m +-4 | | a | c | abc,abc | 200m |
| c | a | abc,abc | 200m +-4 | | c | a | abc,abc | 200m |
Scenario: 1km distance Scenario: 1km distance
Given a grid size of 1000 meters Given a grid size of 1000 meters
@ -107,12 +107,12 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | b | abc,abc | 1000m +-2 | | a | b | abc,abc | 1000m +-1 |
| b | a | abc,abc | 1000m +-2 | | b | a | abc,abc | 1000m +-1 |
| b | c | abc,abc | 1000m +-2 | | b | c | abc,abc | 1000m +-1 |
| c | b | abc,abc | 1000m +-2 | | c | b | abc,abc | 1000m +-1 |
| a | c | abc,abc | 2000m +-4 | | a | c | abc,abc | 2000m +-1 |
| c | a | abc,abc | 2000m +-4 | | c | a | abc,abc | 2000m +-1 |
Scenario: Distance of a winding south-north path Scenario: Distance of a winding south-north path
Given a grid size of 10 meters Given a grid size of 10 meters
@ -130,13 +130,13 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | b | abcdefgh,abcdefgh | 10m +-2 | | a | b | abcdefgh,abcdefgh | 10m |
| a | c | abcdefgh,abcdefgh | 20m +-4 | | a | c | abcdefgh,abcdefgh | 20m |
| a | d | abcdefgh,abcdefgh | 30m +-6 | | a | d | abcdefgh,abcdefgh | 30m |
| a | e | abcdefgh,abcdefgh | 40m +-8 | | a | e | abcdefgh,abcdefgh | 40m |
| a | f | abcdefgh,abcdefgh | 50m +-10 | | a | f | abcdefgh,abcdefgh | 50m |
| a | g | abcdefgh,abcdefgh | 60m +-12 | | a | g | abcdefgh,abcdefgh | 60m +-1 |
| a | h | abcdefgh,abcdefgh | 70m +-14 | | a | h | abcdefgh,abcdefgh | 70m +-1 |
Scenario: Distance of a winding east-west path Scenario: Distance of a winding east-west path
Given a grid size of 10 meters Given a grid size of 10 meters
@ -152,13 +152,13 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | b | abcdefgh,abcdefgh | 10m +-2 | | a | b | abcdefgh,abcdefgh | 10m |
| a | c | abcdefgh,abcdefgh | 20m +-4 | | a | c | abcdefgh,abcdefgh | 20m |
| a | d | abcdefgh,abcdefgh | 30m +-6 | | a | d | abcdefgh,abcdefgh | 30m |
| a | e | abcdefgh,abcdefgh | 40m +-8 | | a | e | abcdefgh,abcdefgh | 40m |
| a | f | abcdefgh,abcdefgh | 50m +-10 | | a | f | abcdefgh,abcdefgh | 50m |
| a | g | abcdefgh,abcdefgh | 60m +-12 | | a | g | abcdefgh,abcdefgh | 60m +-1 |
| a | h | abcdefgh,abcdefgh | 70m +-14 | | a | h | abcdefgh,abcdefgh | 70m +-1 |
Scenario: Geometric distances Scenario: Geometric distances
Given a grid size of 100 meters Given a grid size of 100 meters
@ -201,31 +201,31 @@ Feature: Distance calculation
| xy | | xy |
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| x | a | xa,xa | 300m +-2 | | x | a | xa,xa | 300m +-1 |
| x | b | xb,xb | 316m +-2 | | x | b | xb,xb | 316m +-1 |
| x | c | xc,xc | 360m +-2 | | x | c | xc,xc | 360m +-1 |
| x | d | xd,xd | 424m +-2 | | x | d | xd,xd | 424m +-1 |
| x | e | xe,xe | 360m +-2 | | x | e | xe,xe | 360m +-1 |
| x | f | xf,xf | 316m +-2 | | x | f | xf,xf | 316m +-1 |
| x | g | xg,xg | 300m +-2 | | x | g | xg,xg | 300m +-1 |
| x | h | xh,xh | 316m +-2 | | x | h | xh,xh | 316m +-1 |
| x | i | xi,xi | 360m +-2 | | x | i | xi,xi | 360m +-1 |
| x | j | xj,xj | 424m +-2 | | x | j | xj,xj | 424m +-1 |
| x | k | xk,xk | 360m +-2 | | x | k | xk,xk | 360m +-1 |
| x | l | xl,xl | 316m +-2 | | x | l | xl,xl | 316m +-1 |
| x | m | xm,xm | 300m +-2 | | x | m | xm,xm | 300m +-1 |
| x | n | xn,xn | 316m +-2 | | x | n | xn,xn | 316m +-1 |
| x | o | xo,xo | 360m +-2 | | x | o | xo,xo | 360m +-1 |
| x | p | xp,xp | 424m +-2 | | x | p | xp,xp | 424m +-1 |
| x | q | xq,xq | 360m +-2 | | x | q | xq,xq | 360m +-1 |
| x | r | xr,xr | 316m +-2 | | x | r | xr,xr | 316m +-1 |
| x | s | xs,xs | 300m +-2 | | x | s | xs,xs | 300m +-1 |
| x | t | xt,xt | 316m +-2 | | x | t | xt,xt | 316m +-1 |
| x | u | xu,xu | 360m +-2 | | x | u | xu,xu | 360m +-1 |
| x | v | xv,xv | 424m +-2 | | x | v | xv,xv | 424m +-1 |
| x | w | xw,xw | 360m +-2 | | x | w | xw,xw | 360m +-1 |
| x | y | xy,xy | 316m +-2 | | x | y | xy,xy | 316m +-1 |
@maze @maze
Scenario: Distance of a maze of short segments Scenario: Distance of a maze of short segments
@ -245,4 +245,4 @@ Feature: Distance calculation
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| a | t | abcdefghijklmnopqrst,abcdefghijklmnopqrst | 133m +-2 | | a | t | abcdefghijklmnopqrst,abcdefghijklmnopqrst | 133m +-1 |

View File

@ -52,9 +52,9 @@ Feature: Basic Distance Matrix
| ab | | ab |
When I request a travel time matrix I should get When I request a travel time matrix I should get
| | a | b | | | a | b |
| a | 0 | 9 +- 2 | | a | 0 | 10 |
| b | 9 ~15% | 0 | | b | 10 | 0 |
Scenario: Testbot - Travel time matrix of small grid Scenario: Testbot - Travel time matrix of small grid
Given the node map Given the node map

View File

@ -164,8 +164,8 @@ Feature: Testbot - Handle ferry routes
| xa | primary | | | | xa | primary | | |
| yg | primary | | | | yg | primary | | |
| xy | primary | | | | xy | primary | | |
| abcd | | ferry | 0:01 | | abcd | | ferry | 0:02 |
| defg | | ferry | 0:01 | | defg | | ferry | 0:02 |
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
@ -187,8 +187,8 @@ Feature: Testbot - Handle ferry routes
When I route I should get When I route I should get
| from | to | route | time | | from | to | route | time |
| a | g | abcdefg,abcdefg | 23400s +-2 | | a | g | abcdefg,abcdefg | 23400s +-3 |
| g | a | abcdefg,abcdefg | 23400s +-2 | | g | a | abcdefg,abcdefg | 23400s +-3 |
@todo @todo
Scenario: Testbot - Ferry duration formats Scenario: Testbot - Ferry duration formats

View File

@ -141,15 +141,15 @@ Feature: Basic Map Matching
And the contract extra arguments "--segment-speed-file {speeds_file}" And the contract extra arguments "--segment-speed-file {speeds_file}"
When I match I should get When I match I should get
| trace | matchings | annotation | | trace | matchings | annotation |
| abeh | abeh | 1:9.897633:1,0:0:0,1:10.008842:0,1:10.008842:0,1:10.008842:0,0:0:0,2:20.017685:0,1:10.008842:0 | | abeh | abeh | 1:10.008842:1,0:0:0,1:10.008842:0,1:10.008842:0,1:10.008842:0,0:0:0,2:19.906475:0,1:10.008842:0 |
| abci | abci | 1:9.897633:1,0:0:0,1:10.008842:0,0:0.111209:0,1:10.010367:0 | | abci | abci | 1:10.008842:1,0:0:0,1:10.008842:0,0:0:0,1:10.010367:0 |
# The following is the same as the above, but separated for readability (line length) # The following is the same as the above, but separated for readability (line length)
When I match I should get When I match I should get
| trace | matchings | OSM IDs | | trace | matchings | OSM IDs |
| abeh | abeh | 1,2,3,2,3,4,5,4,5,6,7 | | abeh | abeh | 1,2,3,2,3,4,5,4,5,6,7 |
| abci | abci | 1,2,3,2,3,8,3,8 | | abci | abci | 1,2,3,2,3,2,3,8 |
Scenario: Testbot - Regression test for #3037 Scenario: Testbot - Regression test for #3037
Given the query options Given the query options
@ -174,8 +174,8 @@ Feature: Basic Map Matching
| fb | yes | | fb | yes |
When I match I should get When I match I should get
| trace | matchings | geometry | | trace | matchings | geometry |
| efbc | efbc | 1,0.99964,1.000359,0.99964,1.000359,1,1.000718,1 | | efbc | efbc | 1,0.99964,1.00036,0.99964,1.00036,1,1.000719,1 |
Scenario: Testbot - Geometry details using geojson Scenario: Testbot - Geometry details using geojson
Given the query options Given the query options
@ -194,8 +194,8 @@ Feature: Basic Map Matching
| bd | no | | bd | no |
When I match I should get When I match I should get
| trace | matchings | geometry | | trace | matchings | geometry |
| abd | abd | 1,1,1.000089,1,1.000089,1,1.000089,0.99991 | | abd | abd | 1,1,1.00009,1,1.00009,1,1.00009,0.99991 |
Scenario: Testbot - Geometry details using polyline Scenario: Testbot - Geometry details using polyline
Given the query options Given the query options
@ -234,8 +234,8 @@ Feature: Basic Map Matching
| bd | no | | bd | no |
When I match I should get When I match I should get
| trace | matchings | geometry | | trace | matchings | geometry |
| abd | abd | 1,1,1,1.000089,1,1.000089,0.99991,1.000089 | | abd | abd | 1,1,1,1.00009,1,1.00009,0.99991,1.00009 |
Scenario: Testbot - Speed greater than speed threshhold Scenario: Testbot - Speed greater than speed threshhold
Given a grid size of 10 meters Given a grid size of 10 meters

View File

@ -53,7 +53,7 @@ Feature: Routing close to the [0,0] origin
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| b | d | abcde,abcde | 200m +-2 | | b | d | abcde,abcde | 200m |
| d | b | | | | d | b | | |
Scenario: North-south oneways crossing the origin Scenario: North-south oneways crossing the origin
@ -71,5 +71,5 @@ Feature: Routing close to the [0,0] origin
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| b | d | abcde,abcde | 200m +-2 | | b | d | abcde,abcde | 200m |
| d | b | | | | d | b | | |

View File

@ -11,11 +11,11 @@ Feature: Projection to nearest point on road
Given the profile "testbot" Given the profile "testbot"
Given the node locations Given the node locations
| node | lat | lon | | node | lat | lon |
| a | 80.00000 | 0.00000 | | a | 80.000000 | 0.0000000 |
| b | 80.00639 | 0.03667 | | b | 80.006350 | 0.0366666 |
| c | 80.01278 | 0.07333 | | c | 80.012730 | 0.0733333 |
| d | 80.00000 | 0.07333 | | d | 80.000000 | 0.0733333 |
And the ways And the ways
| nodes | | nodes |
@ -23,16 +23,16 @@ Feature: Projection to nearest point on road
Scenario: Projection onto way at high latitudes, 1km distance Scenario: Projection onto way at high latitudes, 1km distance
When I route I should get When I route I should get
| from | to | route | bearing | distance | | from | to | route | bearing | distance |
| b | a | abc,abc | 0->225,225->0 | 1000m +- 7 | | b | a | abc,abc | 0->225,225->0 | 1000m |
| b | c | abc,abc | 0->45,45->0 | 1000m +- 7 | | b | c | abc,abc | 0->45,45->0 | 1000m +- 3 |
| a | d | abc,abc | 0->45,45->0 | 1000m +- 7 | | a | d | abc,abc | 0->45,45->0 | 1000m |
| d | a | abc,abc | 0->225,225->0 | 1000m +- 7 | | d | a | abc,abc | 0->225,225->0 | 1000m |
| c | d | abc,abc | 0->225,224->0 | 1000m +- 8 | | c | d | abc,abc | 0->225,225->0 | 1000m +- 3 |
| d | c | abc,abc | 0->44,45->0 | 1000m +- 8 | | d | c | abc,abc | 0->45,45->0 | 1000m +- 3 |
Scenario: Projection onto way at high latitudes, no distance Scenario: Projection onto way at high latitudes, no distance
When I route I should get When I route I should get
| from | to | route | distance | | from | to | route | distance |
| d | b | abc,abc | 0m +-5 | | d | b | abc,abc | 0m |
| b | d | abc,abc | 0m +-5 | | b | d | abc,abc | 0m |

View File

@ -141,9 +141,9 @@ Feature: Basic trip planning
| da | | da |
When I plan a trip I should get When I plan a trip I should get
| waypoints | trips | durations | geometry | | waypoints | trips | durations | geometry |
| a,b,c,d | abcda | 7.6 | 1,1,1.000089,1,1,0.99991,1.000089,1,1,1,1.000089,0.99991,1,1 | | a,b,c,d | abcda | 7.6 | 1,1,1.00009,1,1,0.99991,1.00009,1,1,1,1.00009,0.99991,1,1 |
| d,b,c,a | dbcad | 7.6 | 1.000089,0.99991,1,1,1.000089,1,1,0.99991,1.000089,1,1,1,1.000089,0.99991 | | d,b,c,a | dbcad | 7.6 | 1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009,1,1,1,1.00009,0.99991 |
Scenario: Testbot - Trip with geometry details of polyline Scenario: Testbot - Trip with geometry details of polyline
Given the query options Given the query options
@ -185,6 +185,6 @@ Feature: Basic trip planning
| da | | da |
When I plan a trip I should get When I plan a trip I should get
| waypoints | trips | durations | geometry | | waypoints | trips | durations | geometry |
| a,b,c,d | abcda | 7.6 | 1,1,1,1.000089,0.99991,1,1,1.000089,1,1,0.99991,1.000089,1,1 | | a,b,c,d | abcda | 7.6 | 1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009,1,1 |
| d,b,c,a | dbcad | 7.6 | 0.99991,1.000089,1,1,1,1.000089,0.99991,1,1,1.000089,1,1,0.99991,1.000089 | | d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 |

View File

@ -60,7 +60,8 @@ OSRM_STRONG_TYPEDEF(double, FloatLongitude)
inline FixedLatitude toFixed(const FloatLatitude floating) inline FixedLatitude toFixed(const FloatLatitude floating)
{ {
const auto latitude = static_cast<double>(floating); const auto latitude = static_cast<double>(floating);
const auto fixed = boost::numeric_cast<std::int32_t>(latitude * COORDINATE_PRECISION); const auto fixed =
boost::numeric_cast<std::int32_t>(std::round(latitude * COORDINATE_PRECISION));
return FixedLatitude{fixed}; return FixedLatitude{fixed};
} }
@ -74,7 +75,8 @@ inline FixedLatitude toFixed(const FloatLatitude floating)
inline FixedLongitude toFixed(const FloatLongitude floating) inline FixedLongitude toFixed(const FloatLongitude floating)
{ {
const auto longitude = static_cast<double>(floating); const auto longitude = static_cast<double>(floating);
const auto fixed = boost::numeric_cast<std::int32_t>(longitude * COORDINATE_PRECISION); const auto fixed =
boost::numeric_cast<std::int32_t>(std::round(longitude * COORDINATE_PRECISION));
return FixedLongitude{fixed}; return FixedLongitude{fixed};
} }

View File

@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(raster_test)
CHECK_INTERPOLATE(0, 1.08, 1.05, 160); CHECK_INTERPOLATE(0, 1.08, 1.05, 160);
CHECK_INTERPOLATE(0, 1.01, 1.05, 20); CHECK_INTERPOLATE(0, 1.01, 1.05, 20);
// ARBITRARY - BETWEEN DATA // ARBITRARY - BETWEEN DATA
CHECK_INTERPOLATE(0, 1.054, 1.023, 53); CHECK_INTERPOLATE(0, 1.054, 1.023, 54);
CHECK_INTERPOLATE(0, 1.056, 1.028, 68); CHECK_INTERPOLATE(0, 1.056, 1.028, 68);
CHECK_INTERPOLATE(0, 1.05, 1.028, 56); CHECK_INTERPOLATE(0, 1.05, 1.028, 56);

View File

@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture)
for (auto &itr : result.values["waypoints"].get<json::Array>().values) for (auto &itr : result.values["waypoints"].get<json::Array>().values)
itr.get<json::Object>().values["hint"] = ""; itr.get<json::Object>().values["hint"] = "";
const auto location = json::Array{{{7.437070}, {43.749247}}}; const auto location = json::Array{{{7.437070}, {43.749248}}};
json::Object reference{ json::Object reference{
{{"code", "Ok"}, {{"code", "Ok"},

View File

@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(test_tile)
const auto rc = osrm.Tile(params, result); const auto rc = osrm.Tile(params, result);
BOOST_CHECK(rc == Status::Ok); BOOST_CHECK(rc == Status::Ok);
BOOST_CHECK_EQUAL(result.size(), 114098); BOOST_CHECK_EQUAL(result.size(), 114033);
protozero::pbf_reader tile_message(result); protozero::pbf_reader tile_message(result);
tile_message.next(); tile_message.next();
@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns)
} }
std::sort(actual_turn_penalties.begin(), actual_turn_penalties.end()); std::sort(actual_turn_penalties.begin(), actual_turn_penalties.end());
const std::vector<float> expected_turn_penalties = { const std::vector<float> expected_turn_penalties = {
0, 0, 0, 0, 0, 0, .1f, .1f, .3f, .4f, 1.3f, 1.8f, 5.4f, 5.5f, 5.8f, 7.1f, 7.2f, 7.2f}; 0, 0, 0, 0, 0, 0, .1f, .1f, .3f, .4f, 1.2f, 1.9f, 5.3f, 5.5f, 5.8f, 7.1f, 7.2f, 7.2f};
BOOST_CHECK(actual_turn_penalties == expected_turn_penalties); BOOST_CHECK(actual_turn_penalties == expected_turn_penalties);
// Verify the expected turn angles // Verify the expected turn angles
@ -342,7 +342,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns)
} }
std::sort(actual_turn_angles.begin(), actual_turn_angles.end()); std::sort(actual_turn_angles.begin(), actual_turn_angles.end());
const std::vector<std::int64_t> expected_turn_angles = { const std::vector<std::int64_t> expected_turn_angles = {
-123, -120, -118, -64, -57, -29, -28, -3, -2, 2, 3, 28, 29, 57, 64, 118, 120, 123}; -122, -120, -117, -65, -57, -30, -28, -3, -2, 2, 3, 28, 30, 57, 65, 117, 120, 122};
BOOST_CHECK(actual_turn_angles == expected_turn_angles); BOOST_CHECK(actual_turn_angles == expected_turn_angles);
// Verify the expected bearings // Verify the expected bearings
@ -354,7 +354,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns)
} }
std::sort(actual_turn_bearings.begin(), actual_turn_bearings.end()); std::sort(actual_turn_bearings.begin(), actual_turn_bearings.end());
const std::vector<std::int64_t> expected_turn_bearings = { const std::vector<std::int64_t> expected_turn_bearings = {
49, 49, 106, 106, 169, 169, 171, 171, 229, 229, 258, 258, 287, 287, 349, 349, 352, 352}; 49, 49, 107, 107, 169, 169, 171, 171, 229, 229, 257, 257, 286, 286, 349, 349, 352, 352};
BOOST_CHECK(actual_turn_bearings == expected_turn_bearings); BOOST_CHECK(actual_turn_bearings == expected_turn_bearings);
} }

View File

@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE(circleCenter)
auto result = coordinate_calculation::circleCenter(a, b, c); auto result = coordinate_calculation::circleCenter(a, b, c);
BOOST_CHECK(result); BOOST_CHECK(result);
BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-100.000833}, FloatLatitude{10.000833})); BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-100.0008333}, FloatLatitude{10.0008333}));
// Co-linear longitude // Co-linear longitude
a = Coordinate(FloatLongitude{-100.}, FloatLatitude{10.}); a = Coordinate(FloatLongitude{-100.}, FloatLatitude{10.});
@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(circleCenter)
c = Coordinate(FloatLongitude{-112.096419}, FloatLatitude{41.147259}); c = Coordinate(FloatLongitude{-112.096419}, FloatLatitude{41.147259});
result = coordinate_calculation::circleCenter(a, b, c); result = coordinate_calculation::circleCenter(a, b, c);
BOOST_CHECK(result); BOOST_CHECK(result);
BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.09642}, FloatLatitude{41.14707})); BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.09642}, FloatLatitude{41.1470705}));
// Co-linear latitude, variation // Co-linear latitude, variation
a = Coordinate(FloatLongitude{-112.096234}, FloatLatitude{41.147101}); a = Coordinate(FloatLongitude{-112.096234}, FloatLatitude{41.147101});
@ -293,7 +293,7 @@ BOOST_AUTO_TEST_CASE(circleCenter)
c = Coordinate(FloatLongitude{-112.096419}, FloatLatitude{41.147259}); c = Coordinate(FloatLongitude{-112.096419}, FloatLatitude{41.147259});
result = coordinate_calculation::circleCenter(a, b, c); result = coordinate_calculation::circleCenter(a, b, c);
BOOST_CHECK(result); BOOST_CHECK(result);
BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.096512}, FloatLatitude{41.146962})); BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.0965125}, FloatLatitude{41.1469622}));
// Co-linear latitude, impossible to calculate // Co-linear latitude, impossible to calculate
a = Coordinate(FloatLongitude{-112.096234}, FloatLatitude{41.147259}); a = Coordinate(FloatLongitude{-112.096234}, FloatLatitude{41.147259});