Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git
This commit is contained in:
commit
15f2b21b62
@ -139,7 +139,7 @@ function showResultsRoute(response) {
|
|||||||
routelink += '\');" value="Get Link"></div>';
|
routelink += '\');" value="Get Link"></div>';
|
||||||
|
|
||||||
//Link for the GPX Download
|
//Link for the GPX Download
|
||||||
var gpxLink = '(<a href="'+HOST_ROUTING_URL+'&start='+from.lat.toFixed(6)+','+from.lon.toFixed(6)+'&dest='+to.lat.toFixed(6)+','+to.lon.toFixed(6)+'&z='+this.map.getZoom();
|
var gpxLink = '(<a href="'+HOST_ROUTING_URL+'?start='+from.lat.toFixed(6)+','+from.lon.toFixed(6)+'&dest='+to.lat.toFixed(6)+','+to.lon.toFixed(6)+'&z='+this.map.getZoom();
|
||||||
for(i = 0; i < viaPointsVector.length; i++) {
|
for(i = 0; i < viaPointsVector.length; i++) {
|
||||||
gpxLink += "&via=" + viaPointsVector[i][0] + "," + viaPointsVector[i][1];
|
gpxLink += "&via=" + viaPointsVector[i][0] + "," + viaPointsVector[i][1];
|
||||||
}
|
}
|
||||||
|
@ -61,29 +61,17 @@ Feature: Snap start/end point to the nearest way
|
|||||||
| jkla |
|
| jkla |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route |
|
| from | to | route |
|
||||||
| a | b | abcd |
|
| a | b | abcd |
|
||||||
| a | c | abcd |
|
| a | c | abcd |
|
||||||
| a | d | abcd |
|
| a | d | abcd |
|
||||||
| a | e | abcd |
|
| a | e | abcd,defg |
|
||||||
| a | f | abcd |
|
| a | f | abcd,defg |
|
||||||
| a | g | abcd |
|
| a | h | jkla,ghij |
|
||||||
| a | h | jkla |
|
| a | i | jkla,ghij |
|
||||||
| a | i | jkla |
|
| a | j | jkla |
|
||||||
| a | j | jkla |
|
| a | k | jkla |
|
||||||
| a | k | jkla |
|
| a | l | jkla |
|
||||||
| a | l | jkla |
|
|
||||||
| b | a | abcd |
|
|
||||||
| b | c | abcd |
|
|
||||||
| b | d | abcd |
|
|
||||||
| b | e | abcd |
|
|
||||||
| b | f | abcd |
|
|
||||||
| b | g | abcd |
|
|
||||||
| b | h | jkla |
|
|
||||||
| b | i | jkla |
|
|
||||||
| b | j | jkla |
|
|
||||||
| b | k | jkla |
|
|
||||||
| b | l | jkla |
|
|
||||||
|
|
||||||
Scenario: Snap to correct way at large scales
|
Scenario: Snap to correct way at large scales
|
||||||
Given a grid size of 1000 meters
|
Given a grid size of 1000 meters
|
||||||
|
@ -8,6 +8,10 @@ Given /^the speedprofile settings$/ do |table|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given /^a grid size of (\d+) meters$/ do |meters|
|
||||||
|
set_grid_size meters
|
||||||
|
end
|
||||||
|
|
||||||
Given /^the nodes$/ do |table|
|
Given /^the nodes$/ do |table|
|
||||||
table.raw.each_with_index do |row,ri|
|
table.raw.each_with_index do |row,ri|
|
||||||
row.each_with_index do |name,ci|
|
row.each_with_index do |name,ci|
|
||||||
@ -15,7 +19,7 @@ Given /^the nodes$/ do |table|
|
|||||||
raise "*** node invalid name '#{name}', must be single characters" unless name.size == 1
|
raise "*** node invalid name '#{name}', must be single characters" unless name.size == 1
|
||||||
raise "*** invalid node name '#{name}', must me alphanumeric" unless name.match /[a-z0-9]/
|
raise "*** invalid node name '#{name}', must me alphanumeric" unless name.match /[a-z0-9]/
|
||||||
raise "*** duplicate node '#{name}'" if name_node_hash[name]
|
raise "*** duplicate node '#{name}'" if name_node_hash[name]
|
||||||
node = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+ci*ZOOM, ORIGIN[1]-ri*ZOOM
|
node = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+ci*@zoom, ORIGIN[1]-ri*@zoom
|
||||||
node << { :name => name }
|
node << { :name => name }
|
||||||
node.uid = OSM_UID
|
node.uid = OSM_UID
|
||||||
osm_db << node
|
osm_db << node
|
||||||
|
@ -157,8 +157,6 @@ Then /^routability should be$/ do |table|
|
|||||||
table.hashes.each_with_index do |row,i|
|
table.hashes.each_with_index do |row,i|
|
||||||
got = row.dup
|
got = row.dup
|
||||||
attempts = []
|
attempts = []
|
||||||
row['way'] = "w#{i}"
|
|
||||||
got['way'] = "w#{i}"
|
|
||||||
['forw','backw'].each do |direction|
|
['forw','backw'].each do |direction|
|
||||||
if table.headers.include? direction
|
if table.headers.include? direction
|
||||||
if direction == 'forw'
|
if direction == 'forw'
|
||||||
@ -168,10 +166,13 @@ Then /^routability should be$/ do |table|
|
|||||||
end
|
end
|
||||||
got[direction] = route_status response
|
got[direction] = route_status response
|
||||||
json = JSON.parse(response.body)
|
json = JSON.parse(response.body)
|
||||||
if got[direction] == 'x'
|
if got[direction].empty? == false
|
||||||
route = way_list json['route_instructions']
|
route = way_list json['route_instructions']
|
||||||
if route != "w#{i}"
|
if route != "w#{i}"
|
||||||
got[direction] = "#{route}?"
|
got[direction] = "testing w#{i}, but got #{route}!?"
|
||||||
|
elsif row[direction] =~ /\d+s/
|
||||||
|
time = json['route_summary']['total_time']
|
||||||
|
got[direction] = "#{time}s"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if got[direction] != row[direction]
|
if got[direction] != row[direction]
|
||||||
@ -203,7 +204,7 @@ When /^I route I should get$/ do |table|
|
|||||||
instructions = way_list json['route_instructions']
|
instructions = way_list json['route_instructions']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
got = {'from' => row['from'], 'to' => row['to'] }
|
got = {'from' => row['from'], 'to' => row['to'] }
|
||||||
if table.headers.include? 'start'
|
if table.headers.include? 'start'
|
||||||
got['start'] = instructions ? json['route_summary']['start_point'] : nil
|
got['start'] = instructions ? json['route_summary']['start_point'] : nil
|
||||||
@ -213,15 +214,20 @@ When /^I route I should get$/ do |table|
|
|||||||
end
|
end
|
||||||
if table.headers.include? 'route'
|
if table.headers.include? 'route'
|
||||||
got['route'] = (instructions || '').strip
|
got['route'] = (instructions || '').strip
|
||||||
end
|
if table.headers.include? 'distance'
|
||||||
if table.headers.include? 'distance'
|
got['distance'] = instructions ? json['route_summary']['total_distance'].to_s : nil
|
||||||
got['distance'] = instructions ? json['route_summary']['total_distance'].to_s : nil
|
end
|
||||||
|
if table.headers.include? 'time'
|
||||||
|
raise "*** time must be specied in seconds. (ex: 60s)" unless row['time'] =~ /\d+s/
|
||||||
|
got['time'] = instructions ? "#{json['route_summary']['total_time'].to_s}s" : nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if row != got
|
if row != got
|
||||||
failed = { :attempt => 'route', :query => @query, :response => response }
|
failed = { :attempt => 'route', :query => @query, :response => response }
|
||||||
log_fail row,got,[failed]
|
log_fail row,got,[failed]
|
||||||
end
|
end
|
||||||
|
|
||||||
actual << got
|
actual << got
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,10 +12,13 @@ LOG_FILE = 'fail.log'
|
|||||||
OSM_TIMESTAMP = '2000-00-00T00:00:00Z'
|
OSM_TIMESTAMP = '2000-00-00T00:00:00Z'
|
||||||
DEFAULT_SPEEDPROFILE = 'bicycle'
|
DEFAULT_SPEEDPROFILE = 'bicycle'
|
||||||
WAY_SPACING = 10
|
WAY_SPACING = 10
|
||||||
|
DEFAULT_GRID_SIZE = 100 #meters
|
||||||
|
|
||||||
ORIGIN = [1,1]
|
ORIGIN = [1,1]
|
||||||
NODE_SPACING = 100 #meters
|
|
||||||
ZOOM = 0.001*(NODE_SPACING.to_f/111.0)
|
def set_grid_size meters
|
||||||
|
@zoom = 0.001*(meters.to_f/111.21)
|
||||||
|
end
|
||||||
|
|
||||||
def build_ways_from_table table
|
def build_ways_from_table table
|
||||||
#add one unconnected way for each row
|
#add one unconnected way for each row
|
||||||
@ -28,10 +31,10 @@ def build_ways_from_table table
|
|||||||
#instead we place all lines as a string on the same y coordinate. this prevents using neightboring ways.
|
#instead we place all lines as a string on the same y coordinate. this prevents using neightboring ways.
|
||||||
|
|
||||||
#a few nodes...
|
#a few nodes...
|
||||||
node1 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(0+WAY_SPACING*ri)*ZOOM, ORIGIN[1]
|
node1 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(0+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||||
node2 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(1+WAY_SPACING*ri)*ZOOM, ORIGIN[1]
|
node2 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(1+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||||
node3 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(2+WAY_SPACING*ri)*ZOOM, ORIGIN[1]
|
node3 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(2+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||||
node4 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(3+WAY_SPACING*ri)*ZOOM, ORIGIN[1]
|
node4 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(3+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||||
node1.uid = OSM_UID
|
node1.uid = OSM_UID
|
||||||
node2.uid = OSM_UID
|
node2.uid = OSM_UID
|
||||||
node3.uid = OSM_UID
|
node3.uid = OSM_UID
|
||||||
|
@ -4,6 +4,7 @@ Before do |scenario|
|
|||||||
reset_data
|
reset_data
|
||||||
@has_logged_preprocess_info = false
|
@has_logged_preprocess_info = false
|
||||||
@has_logged_scenario_info = false
|
@has_logged_scenario_info = false
|
||||||
|
set_grid_size DEFAULT_GRID_SIZE
|
||||||
end
|
end
|
||||||
|
|
||||||
Around('@routing') do |scenario, block|
|
Around('@routing') do |scenario, block|
|
||||||
|
182
features/time.feature
Normal file
182
features/time.feature
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
@routing @time
|
||||||
|
Feature: Estimation of travel time
|
||||||
|
Note:
|
||||||
|
15km/h = 15000m/3600s = 150m/36s = 100m/24s
|
||||||
|
5km/h = 5000m/3600s = 50m/36s = 100m/72s
|
||||||
|
|
||||||
|
Background: Use specific speeds
|
||||||
|
Given the speedprofile "bicycle"
|
||||||
|
And the speedprofile settings
|
||||||
|
| primary | 15 |
|
||||||
|
| footway | 5 |
|
||||||
|
|
||||||
|
Scenario: Basic travel time, 1m scale
|
||||||
|
Given a grid size of 1 meters
|
||||||
|
Given the nodes
|
||||||
|
| h | a | b |
|
||||||
|
| g | x | c |
|
||||||
|
| f | e | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| xa | primary |
|
||||||
|
| xb | primary |
|
||||||
|
| xc | primary |
|
||||||
|
| xd | primary |
|
||||||
|
| xe | primary |
|
||||||
|
| xf | primary |
|
||||||
|
| xg | primary |
|
||||||
|
| xh | primary |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| x | a | xa | 0s |
|
||||||
|
| x | b | xb | 0s |
|
||||||
|
| x | c | xc | 0s |
|
||||||
|
| x | d | xd | 0s |
|
||||||
|
| x | e | xe | 0s |
|
||||||
|
| x | f | xf | 0s |
|
||||||
|
| x | g | xg | 0s |
|
||||||
|
| x | h | xh | 0s |
|
||||||
|
|
||||||
|
Scenario: Basic travel time, 100m scale
|
||||||
|
Given a grid size of 100 meters
|
||||||
|
Given the nodes
|
||||||
|
| h | a | b |
|
||||||
|
| g | x | c |
|
||||||
|
| f | e | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| xa | primary |
|
||||||
|
| xb | primary |
|
||||||
|
| xc | primary |
|
||||||
|
| xd | primary |
|
||||||
|
| xe | primary |
|
||||||
|
| xf | primary |
|
||||||
|
| xg | primary |
|
||||||
|
| xh | primary |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| x | a | xa | 24s |
|
||||||
|
| x | b | xb | 34s |
|
||||||
|
| x | c | xc | 24s |
|
||||||
|
| x | d | xd | 34s |
|
||||||
|
| x | e | xe | 24s |
|
||||||
|
| x | f | xf | 34s |
|
||||||
|
| x | g | xg | 24s |
|
||||||
|
| x | h | xh | 34s |
|
||||||
|
|
||||||
|
Scenario: Basic travel time, 10km scale
|
||||||
|
Given a grid size of 10000 meters
|
||||||
|
Given the nodes
|
||||||
|
| h | a | b |
|
||||||
|
| g | x | c |
|
||||||
|
| f | e | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| xa | primary |
|
||||||
|
| xb | primary |
|
||||||
|
| xc | primary |
|
||||||
|
| xd | primary |
|
||||||
|
| xe | primary |
|
||||||
|
| xf | primary |
|
||||||
|
| xg | primary |
|
||||||
|
| xh | primary |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| x | a | xa | 2400s |
|
||||||
|
| x | b | xb | 3400s |
|
||||||
|
| x | c | xc | 2400s |
|
||||||
|
| x | d | xd | 3400s |
|
||||||
|
| x | e | xe | 2400s |
|
||||||
|
| x | f | xf | 3400s |
|
||||||
|
| x | g | xg | 2400s |
|
||||||
|
| x | h | xh | 3400s |
|
||||||
|
|
||||||
|
Scenario: Time of travel depending on way type
|
||||||
|
Given the nodes
|
||||||
|
| a | b |
|
||||||
|
| c | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| ab | primary |
|
||||||
|
| cd | footway |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 24s |
|
||||||
|
| c | d | cd | 72s |
|
||||||
|
|
||||||
|
Scenario: Time of travel on a series of ways
|
||||||
|
Given the nodes
|
||||||
|
| a | b | c | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| ab | primary |
|
||||||
|
| bc | primary |
|
||||||
|
| cd | primary |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 24s |
|
||||||
|
| a | c | ab,bc | 48s |
|
||||||
|
| a | d | ab,bc,cd | 72s |
|
||||||
|
|
||||||
|
Scenario: Time of travel on a winding way
|
||||||
|
Given the nodes
|
||||||
|
| a | b | | | | |
|
||||||
|
| | c | d | e | | i |
|
||||||
|
| | | | f | g | h |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| abcdefghi | primary |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | abcdefghi | 24s |
|
||||||
|
| a | e | abcdefghi | 96s |
|
||||||
|
| a | i | abcdefghi | 192s |
|
||||||
|
|
||||||
|
Scenario: Time of travel on combination of road types
|
||||||
|
Given the nodes
|
||||||
|
| a | b | c | d | e |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| abc | primary |
|
||||||
|
| cde | footway |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| b | c | abc | 24s |
|
||||||
|
| c | e | cde | 72s |
|
||||||
|
| b | d | abc,cde | 144s |
|
||||||
|
| a | e | abc,cde | 192s |
|
||||||
|
|
||||||
|
Scenario: Time of travel on part of a way
|
||||||
|
Given the nodes
|
||||||
|
| a | 1 |
|
||||||
|
| | 2 |
|
||||||
|
| | 3 |
|
||||||
|
| b | 4 |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| ab | primary |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| 1 | 2 | ab | 24s |
|
||||||
|
| 1 | 3 | ab | 48s |
|
||||||
|
| 1 | 4 | ab | 72s |
|
||||||
|
| 4 | 3 | ab | 24s |
|
||||||
|
| 4 | 2 | ab | 48s |
|
||||||
|
| 4 | 1 | ab | 72s |
|
||||||
|
|
Loading…
Reference in New Issue
Block a user