From 2f8a07fec9e00f9a68c3cdf2410d8509c8ca116e Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Sat, 23 Feb 2013 13:20:45 +0100 Subject: [PATCH] add test for negative latitudes --- Contractor/EdgeBasedGraphFactory.cpp | 4 ++-- features/testbot/turns.feature | 9 ++++++++- profiles/bicycle.lua | 6 +----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Contractor/EdgeBasedGraphFactory.cpp b/Contractor/EdgeBasedGraphFactory.cpp index 476b4c353..c816902cb 100644 --- a/Contractor/EdgeBasedGraphFactory.cpp +++ b/Contractor/EdgeBasedGraphFactory.cpp @@ -387,9 +387,9 @@ double EdgeBasedGraphFactory::GetAngleBetweenTwoEdges(const CoordinateT& A, cons const double v2x = B.lon - C.lon; const double v2y = B.lat - C.lat; const double latC = (C.lat/100000.)*M_PI/180.; - const double scale = cos(latC); //scale by length of longitude at latitude latC + const double scale = cos(latC); //scale by length of longitude at latitude C const double a2 = atan2(v2y,v2x*scale)*180/M_PI; - const double a1 = atan2(v1y,v1x*scale)*180/M_PI; + const double a1 = atan2(v1y,v1x*scale)*180/M_PI; const double angle = a2-a1; if(angle < 0) { diff --git a/features/testbot/turns.feature b/features/testbot/turns.feature index 77954c2d7..5a14c9e7b 100644 --- a/features/testbot/turns.feature +++ b/features/testbot/turns.feature @@ -97,20 +97,27 @@ Feature: Turn directions/codes | g | c | xg,xc | head,right,destination | | g | e | xg,xe | head,sharp_right,destination | - Scenario: Turn instructions at high latitude + Scenario: Turn instructions at high latitude https://github.com/DennisOSRM/Project-OSRM/issues/532 Given the node locations | node | lat | lon | | a | 55.68740 | 12.52430 | | b | 55.68745 | 12.52409 | | c | 55.68711 | 12.52383 | + | x | -55.68740 | 12.52430 | + | y | -55.68745 | 12.52409 | + | z | -55.68711 | 12.52383 | And the ways | nodes | | ab | | bc | + | xy | + | yz | When I route I should get | from | to | route | turns | | a | c | ab,bc | head,left,destination | | c | a | bc,ab | head,right,destination | + | x | z | xy,yz | head,right,destination | + | z | x | yz,xy | head,left,destination | diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index 025a9bbf6..f6609d097 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -161,11 +161,7 @@ function way_function (way, numberOfNodesInWay) local service = way.tags:Find("service") local area = way.tags:Find("area") local foot = way.tags:Find("foot") - - if name ~= "Vej 6" and name ~= "Skadestuevejen" then - return 0 - end - + -- name if "" ~= ref then way.name = ref