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
+7 -7
View File
@@ -37,13 +37,13 @@ Feature: Bearing parameter
| bc |
When I route I should get
| from | to | bearings | route | bearing |
| 0 | c | 0 0 | | |
| 0 | c | 45 45 | bc,bc | 0->44,44->0 +- 1 |
| 0 | c | 85 85 | | |
| 0 | c | 95 95 | | |
| 0 | c | 135 135 | ac,ac | 0->135,135->0 +- 1|
| 0 | c | 180 180 | | |
| from | to | bearings | route | bearing |
| 0 | c | 0 0 | | |
| 0 | c | 45 45 | bc,bc | 0->45,45->0 |
| 0 | c | 85 85 | | |
| 0 | c | 95 95 | | |
| 0 | c | 135 135 | ac,ac | 0->135,135->0 |
| 0 | c | 180 180 | | |
Scenario: Testbot - Initial bearing on split way
Given the node map
+2 -2
View File
@@ -20,5 +20,5 @@ Feature: Geometry Compression
When I route I should get
| from | to | route | distance | speed |
| b | e | abcdef,abcdef | 588.6m | 36 km/h |
| e | b | abcdef,abcdef | 588.6m | 36 km/h |
| b | e | abcdef,abcdef | 588.5m | 36 km/h |
| e | b | abcdef,abcdef | 588.5m | 36 km/h |
+62 -62
View File
@@ -16,8 +16,8 @@ Feature: Distance calculation
| ab |
When I route I should get
| from | to | route | distance |
| a | b | ab,ab | 100m +- 2 |
| from | to | route | distance |
| a | b | ab,ab | 100m |
Scenario: Distance should equal sum of segments, leftwinded
Given the node map
@@ -33,7 +33,7 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | d | abcde,abcde | 300m +-2 |
| a | d | abcde,abcde | 300m +-1 |
Scenario: Distance should equal sum of segments, rightwinded
Given the node map
@@ -49,7 +49,7 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | d | abcde,abcde | 300m +-2 |
| a | d | abcde,abcde | 300m +-1 |
Scenario: 10m distances
Given a grid size of 10 meters
@@ -65,12 +65,12 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | b | abc,abc | 10m +-2 |
| b | a | abc,abc | 10m +-2 |
| b | c | abc,abc | 10m +-2 |
| c | b | abc,abc | 10m +-2 |
| a | c | abc,abc | 20m +-4 |
| c | a | abc,abc | 20m +-4 |
| a | b | abc,abc | 10m |
| b | a | abc,abc | 10m |
| b | c | abc,abc | 10m |
| c | b | abc,abc | 10m |
| a | c | abc,abc | 20m |
| c | a | abc,abc | 20m |
Scenario: 100m distances
Given a grid size of 100 meters
@@ -86,12 +86,12 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | b | abc,abc | 100m +-2 |
| b | a | abc,abc | 100m +-2 |
| b | c | abc,abc | 100m +-2 |
| c | b | abc,abc | 100m +-2 |
| a | c | abc,abc | 200m +-4 |
| c | a | abc,abc | 200m +-4 |
| a | b | abc,abc | 100m |
| b | a | abc,abc | 100m |
| b | c | abc,abc | 100m |
| c | b | abc,abc | 100m |
| a | c | abc,abc | 200m |
| c | a | abc,abc | 200m |
Scenario: 1km distance
Given a grid size of 1000 meters
@@ -107,12 +107,12 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | b | abc,abc | 1000m +-2 |
| b | a | abc,abc | 1000m +-2 |
| b | c | abc,abc | 1000m +-2 |
| c | b | abc,abc | 1000m +-2 |
| a | c | abc,abc | 2000m +-4 |
| c | a | abc,abc | 2000m +-4 |
| a | b | abc,abc | 1000m +-1 |
| b | a | abc,abc | 1000m +-1 |
| b | c | abc,abc | 1000m +-1 |
| c | b | abc,abc | 1000m +-1 |
| a | c | abc,abc | 2000m +-1 |
| c | a | abc,abc | 2000m +-1 |
Scenario: Distance of a winding south-north path
Given a grid size of 10 meters
@@ -130,13 +130,13 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | b | abcdefgh,abcdefgh | 10m +-2 |
| a | c | abcdefgh,abcdefgh | 20m +-4 |
| a | d | abcdefgh,abcdefgh | 30m +-6 |
| a | e | abcdefgh,abcdefgh | 40m +-8 |
| a | f | abcdefgh,abcdefgh | 50m +-10 |
| a | g | abcdefgh,abcdefgh | 60m +-12 |
| a | h | abcdefgh,abcdefgh | 70m +-14 |
| a | b | abcdefgh,abcdefgh | 10m |
| a | c | abcdefgh,abcdefgh | 20m |
| a | d | abcdefgh,abcdefgh | 30m |
| a | e | abcdefgh,abcdefgh | 40m |
| a | f | abcdefgh,abcdefgh | 50m |
| a | g | abcdefgh,abcdefgh | 60m +-1 |
| a | h | abcdefgh,abcdefgh | 70m +-1 |
Scenario: Distance of a winding east-west path
Given a grid size of 10 meters
@@ -152,13 +152,13 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | b | abcdefgh,abcdefgh | 10m +-2 |
| a | c | abcdefgh,abcdefgh | 20m +-4 |
| a | d | abcdefgh,abcdefgh | 30m +-6 |
| a | e | abcdefgh,abcdefgh | 40m +-8 |
| a | f | abcdefgh,abcdefgh | 50m +-10 |
| a | g | abcdefgh,abcdefgh | 60m +-12 |
| a | h | abcdefgh,abcdefgh | 70m +-14 |
| a | b | abcdefgh,abcdefgh | 10m |
| a | c | abcdefgh,abcdefgh | 20m |
| a | d | abcdefgh,abcdefgh | 30m |
| a | e | abcdefgh,abcdefgh | 40m |
| a | f | abcdefgh,abcdefgh | 50m |
| a | g | abcdefgh,abcdefgh | 60m +-1 |
| a | h | abcdefgh,abcdefgh | 70m +-1 |
Scenario: Geometric distances
Given a grid size of 100 meters
@@ -201,31 +201,31 @@ Feature: Distance calculation
| xy |
When I route I should get
| from | to | route | distance |
| x | a | xa,xa | 300m +-2 |
| x | b | xb,xb | 316m +-2 |
| x | c | xc,xc | 360m +-2 |
| x | d | xd,xd | 424m +-2 |
| x | e | xe,xe | 360m +-2 |
| x | f | xf,xf | 316m +-2 |
| x | g | xg,xg | 300m +-2 |
| x | h | xh,xh | 316m +-2 |
| x | i | xi,xi | 360m +-2 |
| x | j | xj,xj | 424m +-2 |
| x | k | xk,xk | 360m +-2 |
| x | l | xl,xl | 316m +-2 |
| x | m | xm,xm | 300m +-2 |
| x | n | xn,xn | 316m +-2 |
| x | o | xo,xo | 360m +-2 |
| x | p | xp,xp | 424m +-2 |
| x | q | xq,xq | 360m +-2 |
| x | r | xr,xr | 316m +-2 |
| x | s | xs,xs | 300m +-2 |
| x | t | xt,xt | 316m +-2 |
| x | u | xu,xu | 360m +-2 |
| x | v | xv,xv | 424m +-2 |
| x | w | xw,xw | 360m +-2 |
| x | y | xy,xy | 316m +-2 |
| from | to | route | distance |
| x | a | xa,xa | 300m +-1 |
| x | b | xb,xb | 316m +-1 |
| x | c | xc,xc | 360m +-1 |
| x | d | xd,xd | 424m +-1 |
| x | e | xe,xe | 360m +-1 |
| x | f | xf,xf | 316m +-1 |
| x | g | xg,xg | 300m +-1 |
| x | h | xh,xh | 316m +-1 |
| x | i | xi,xi | 360m +-1 |
| x | j | xj,xj | 424m +-1 |
| x | k | xk,xk | 360m +-1 |
| x | l | xl,xl | 316m +-1 |
| x | m | xm,xm | 300m +-1 |
| x | n | xn,xn | 316m +-1 |
| x | o | xo,xo | 360m +-1 |
| x | p | xp,xp | 424m +-1 |
| x | q | xq,xq | 360m +-1 |
| x | r | xr,xr | 316m +-1 |
| x | s | xs,xs | 300m +-1 |
| x | t | xt,xt | 316m +-1 |
| x | u | xu,xu | 360m +-1 |
| x | v | xv,xv | 424m +-1 |
| x | w | xw,xw | 360m +-1 |
| x | y | xy,xy | 316m +-1 |
@maze
Scenario: Distance of a maze of short segments
@@ -245,4 +245,4 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | t | abcdefghijklmnopqrst,abcdefghijklmnopqrst | 133m +-2 |
| a | t | abcdefghijklmnopqrst,abcdefghijklmnopqrst | 133m +-1 |
+3 -3
View File
@@ -52,9 +52,9 @@ Feature: Basic Distance Matrix
| ab |
When I request a travel time matrix I should get
| | a | b |
| a | 0 | 9 +- 2 |
| b | 9 ~15% | 0 |
| | a | b |
| a | 0 | 10 |
| b | 10 | 0 |
Scenario: Testbot - Travel time matrix of small grid
Given the node map
+4 -4
View File
@@ -164,8 +164,8 @@ Feature: Testbot - Handle ferry routes
| xa | primary | | |
| yg | primary | | |
| xy | primary | | |
| abcd | | ferry | 0:01 |
| defg | | ferry | 0:01 |
| abcd | | ferry | 0:02 |
| defg | | ferry | 0:02 |
When I route I should get
| from | to | route | time |
@@ -187,8 +187,8 @@ Feature: Testbot - Handle ferry routes
When I route I should get
| from | to | route | time |
| a | g | abcdefg,abcdefg | 23400s +-2 |
| g | a | abcdefg,abcdefg | 23400s +-2 |
| a | g | abcdefg,abcdefg | 23400s +-3 |
| g | a | abcdefg,abcdefg | 23400s +-3 |
@todo
Scenario: Testbot - Ferry duration formats
+10 -10
View File
@@ -141,15 +141,15 @@ Feature: Basic Map Matching
And the contract extra arguments "--segment-speed-file {speeds_file}"
When I match I should get
| 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 |
| abci | abci | 1:9.897633:1,0:0:0,1:10.008842:0,0:0.111209:0,1:10.010367:0 |
| trace | matchings | annotation |
| 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: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)
When I match I should get
| trace | matchings | OSM IDs |
| 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
Given the query options
@@ -174,8 +174,8 @@ Feature: Basic Map Matching
| fb | yes |
When I match I should get
| trace | matchings | geometry |
| efbc | efbc | 1,0.99964,1.000359,0.99964,1.000359,1,1.000718,1 |
| trace | matchings | geometry |
| efbc | efbc | 1,0.99964,1.00036,0.99964,1.00036,1,1.000719,1 |
Scenario: Testbot - Geometry details using geojson
Given the query options
@@ -194,8 +194,8 @@ Feature: Basic Map Matching
| bd | no |
When I match I should get
| trace | matchings | geometry |
| abd | abd | 1,1,1.000089,1,1.000089,1,1.000089,0.99991 |
| trace | matchings | geometry |
| abd | abd | 1,1,1.00009,1,1.00009,1,1.00009,0.99991 |
Scenario: Testbot - Geometry details using polyline
Given the query options
@@ -234,8 +234,8 @@ Feature: Basic Map Matching
| bd | no |
When I match I should get
| trace | matchings | geometry |
| abd | abd | 1,1,1,1.000089,1,1.000089,0.99991,1.000089 |
| trace | matchings | geometry |
| abd | abd | 1,1,1,1.00009,1,1.00009,0.99991,1.00009 |
Scenario: Testbot - Speed greater than speed threshhold
Given a grid size of 10 meters
+2 -2
View File
@@ -53,7 +53,7 @@ Feature: Routing close to the [0,0] origin
When I route I should get
| from | to | route | distance |
| b | d | abcde,abcde | 200m +-2 |
| b | d | abcde,abcde | 200m |
| d | b | | |
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
| from | to | route | distance |
| b | d | abcde,abcde | 200m +-2 |
| b | d | abcde,abcde | 200m |
| d | b | | |
+14 -14
View File
@@ -11,11 +11,11 @@ Feature: Projection to nearest point on road
Given the profile "testbot"
Given the node locations
| node | lat | lon |
| a | 80.00000 | 0.00000 |
| b | 80.00639 | 0.03667 |
| c | 80.01278 | 0.07333 |
| d | 80.00000 | 0.07333 |
| node | lat | lon |
| a | 80.000000 | 0.0000000 |
| b | 80.006350 | 0.0366666 |
| c | 80.012730 | 0.0733333 |
| d | 80.000000 | 0.0733333 |
And the ways
| nodes |
@@ -23,16 +23,16 @@ Feature: Projection to nearest point on road
Scenario: Projection onto way at high latitudes, 1km distance
When I route I should get
| from | to | route | bearing | distance |
| b | a | abc,abc | 0->225,225->0 | 1000m +- 7 |
| b | c | abc,abc | 0->45,45->0 | 1000m +- 7 |
| a | d | abc,abc | 0->45,45->0 | 1000m +- 7 |
| d | a | abc,abc | 0->225,225->0 | 1000m +- 7 |
| c | d | abc,abc | 0->225,224->0 | 1000m +- 8 |
| d | c | abc,abc | 0->44,45->0 | 1000m +- 8 |
| from | to | route | bearing | distance |
| b | a | abc,abc | 0->225,225->0 | 1000m |
| b | c | abc,abc | 0->45,45->0 | 1000m +- 3 |
| a | d | abc,abc | 0->45,45->0 | 1000m |
| d | a | abc,abc | 0->225,225->0 | 1000m |
| c | d | abc,abc | 0->225,225->0 | 1000m +- 3 |
| d | c | abc,abc | 0->45,45->0 | 1000m +- 3 |
Scenario: Projection onto way at high latitudes, no distance
When I route I should get
| from | to | route | distance |
| d | b | abc,abc | 0m +-5 |
| b | d | abc,abc | 0m +-5 |
| d | b | abc,abc | 0m |
| b | d | abc,abc | 0m |
+6 -6
View File
@@ -141,9 +141,9 @@ Feature: Basic trip planning
| da |
When I plan a trip I should get
| 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 |
| 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 |
| waypoints | trips | durations | geometry |
| 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.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
Given the query options
@@ -185,6 +185,6 @@ Feature: Basic trip planning
| da |
When I plan a trip I should get
| 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 |
| 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 |
| waypoints | trips | durations | geometry |
| 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.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 |