use signed slope to distinguish uphills and downhills
This commit is contained in:
parent
e39dc3c464
commit
8f8df969a2
@ -20,6 +20,6 @@ Feature: osrm-extract with a profile containing raster source
|
|||||||
And the data has been saved to disk
|
And the data has been saved to disk
|
||||||
When I run "osrm-extract {osm_file} -p {profile_file}"
|
When I run "osrm-extract {osm_file} -p {profile_file}"
|
||||||
Then stdout should contain "source loader"
|
Then stdout should contain "source loader"
|
||||||
Then stdout should contain "slope: 0.089906793627046"
|
Then stdout should contain "slope: 0.0899"
|
||||||
Then stdout should contain "slope: 0.089906793627046"
|
Then stdout should contain "slope: -0.0899"
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
@ -50,8 +50,9 @@ Feature: Raster - weights
|
|||||||
And I route I should get
|
And I route I should get
|
||||||
| from | to | route | speed |
|
| from | to | route | speed |
|
||||||
| a | b | ab,ab | 8 km/h |
|
| a | b | ab,ab | 8 km/h |
|
||||||
| a | c | ad,dc,dc | 15 km/h |
|
| b | a | ab,ab | 22 km/h |
|
||||||
| b | c | bc,bc | 8 km/h |
|
| a | c | ab,bc,bc | 12 km/h |
|
||||||
|
| b | c | bc,bc | 22 km/h |
|
||||||
| a | d | ad,ad | 15 km/h |
|
| a | d | ad,ad | 15 km/h |
|
||||||
| d | c | dc,dc | 15 km/h |
|
| d | c | dc,dc | 15 km/h |
|
||||||
| d | e | de,de | 10 km/h |
|
| d | e | de,de | 10 km/h |
|
||||||
|
@ -47,7 +47,7 @@ function segment_function (segment)
|
|||||||
local scaled_duration = segment.duration
|
local scaled_duration = segment.duration
|
||||||
|
|
||||||
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
|
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
|
||||||
local slope = math.abs(sourceData.datum - targetData.datum) / segment.distance
|
local slope = (targetData.datum - sourceData.datum) / segment.distance
|
||||||
scaled_weight = scaled_weight / (1.0 - (slope * 5.0))
|
scaled_weight = scaled_weight / (1.0 - (slope * 5.0))
|
||||||
scaled_duration = scaled_duration / (1.0 - (slope * 5.0))
|
scaled_duration = scaled_duration / (1.0 - (slope * 5.0))
|
||||||
io.write(" slope: " .. slope .. "\n")
|
io.write(" slope: " .. slope .. "\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user