Compare commits

..

15 Commits

Author SHA1 Message Date
Patrick Niklaus d1022043ba Bumbed version to latest.2 2017-12-18 15:54:19 +00:00
Patrick Niklaus 98566bc7e6 Fix broken assertion after rebase 2017-12-18 15:45:04 +00:00
Michael Krasnyk 9d2e57ac7b Make distance_between_roads symmetrical 2017-12-18 15:24:14 +00:00
Michael Krasnyk 5effc60819 Reduce extraction distance to 120 meters
For intersection at https://www.openstreetmap.org/node/65299217
`are_parallel` in MergableRoadDetector::HaveSameDirection is false
for South Van Ness Avenue with 150 meters
2017-12-18 15:24:14 +00:00
Michael Krasnyk 807e4b5ea2 Still use low precision bearings 2017-12-18 15:24:14 +00:00
Michael Krasnyk deb865d421 Add low precision intersection views back 2017-12-18 15:24:14 +00:00
Michael Krasnyk dd8dc76c1b Adjust to review findings 2017-12-18 15:24:14 +00:00
Michael Krasnyk 203036a11d Remove handling of U-turns on motorways 2017-12-18 15:24:14 +00:00
Michael Krasnyk 22d127bc7c Move roads re-ordering to convertToIntersectionView 2017-12-18 15:24:14 +00:00
Michael Krasnyk 12dfa709f1 Remove IntersectionGenerator 2017-12-18 12:50:10 +00:00
Michael Krasnyk 1d4d6dca41 Remove GetConnectedRoads from IntersectionGenerator 2017-12-18 12:48:28 +00:00
Michael Krasnyk 1f8b41489c Remove usage of IntersectionGenerator in EBGF 2017-12-18 12:48:28 +00:00
Michael Krasnyk 68c581c9e6 Free functions for guidance intersections analysis 2017-12-18 12:45:23 +00:00
Michael Krasnyk 0c954fafae Allow to specify empty bearings string in input parameters 2017-12-18 12:45:23 +00:00
Michael Krasnyk 4316886d4b Print statistics only for allowed turns 2017-12-18 12:45:23 +00:00
25 changed files with 114 additions and 404 deletions
+3 -23
View File
@@ -1,31 +1,11 @@
# UNRELEASED
- Changes from 5.14.3:
- Bugfixes:
- Changes from 5.14.1:
- Bugfixes:
- FIXED #4727: Erroring when a old .core file is present.
- FIXED #4704: Fixed regression in bearings reordering introduced in 5.13 [#4704](https://github.com/Project-OSRM/osrm-backend/issues/4704)
- Guidance:
- CHANGED #4706: Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation [#4706](https://github.com/Project-OSRM/osrm-backend/pull/4706)
# 5.14.3
- Changes from 5.14.2:
- Bugfixes:
- FIXED #4754: U-Turn penalties are applied to straight turns.
- FIXED #4756: Removed too restrictive road name check in the sliproad handler
- FIXED #4731: Use correct weights for edge-based graph duplicated via nodes.
- Profile:
- CHANGED: added Belarus speed limits
- CHANGED: set default urban speed in Ukraine to 50kmh
# 5.14.2
- Changes from 5.14.1:
- Bugfixes:
- FIXED #4727: Erroring when a old .core file is present.
- FIXED #4642: Update checks for EMPTY_NAMEID to check for empty name strings
- FIXED #4738: Fix potential segmentation fault
- Node.js Bindings:
- ADDED: Exposed new `max_radiuses_map_matching` option from `EngingConfig` options
- Tools:
- ADDED: New osrm-routed `max_radiuses_map_matching` command line flag to optionally set a maximum radius for map matching
# 5.14.1
- Changes from 5.14.0
- Bugfixes:
-45
View File
@@ -1,45 +0,0 @@
@routing @car
Feature: Car - Handle physical limitation
Background:
Given the profile "car"
Scenario: Car - Use a narrow way
Then routability should be
| highway | width | narrow | bothw |
| primary | | | x |
| primary | narrow | | x |
| primary | | yes | x |
| primary | 1.8 | | |
| primary | 1.9 | | |
| primary | 2.0 | | x |
| primary | 2.1 | | x |
| primary | 1m | | |
| primary | 1 m | | |
| primary | 3 m | | x |
| primary | 6' | | |
| primary | 6'0" | | |
| primary | 6'2" | | |
| primary | 6'3" | | x |
| primary | 7' | | x |
| primary | 7'0" | | x |
Scenario: Car - Limited by width
Then routability should be
| highway | maxwidth:physical | maxwidth | width | est_width | bothw |
| primary | 1 | | | | |
| primary | 3 | | | | x |
| primary | | 1 | | | |
| primary | | 3 | | | x |
| primary | | | 1 | | |
| primary | | | 3 | | x |
| primary | | | | 1 | |
| primary | | | | 3 | x |
Scenario: Car - Limited by height
Then routability should be
| highway | maxheight:physical | maxheight | bothw |
| primary | 1 | | |
| primary | 3 | | x |
| primary | | 1 | |
| primary | | 3 | x |
+3 -49
View File
@@ -992,6 +992,7 @@ Feature: Slipways and Dedicated Turn Lanes
| dbef | primary | dbef | |
| ae | primary_link | ae | yes |
When I route I should get
| waypoints | route | turns | locations |
| s,f | sabc,dbef,dbef | depart,turn right,arrive | s,a,f |
@@ -1018,6 +1019,7 @@ Feature: Slipways and Dedicated Turn Lanes
| dbcf | primary | dbcf | |
| ac | primary_link | ae | yes |
When I route I should get
| waypoints | route | turns | locations |
| s,f | sab,dbcf,dbcf | depart,turn right,arrive | s,a,f |
@@ -1045,55 +1047,7 @@ Feature: Slipways and Dedicated Turn Lanes
| ae | primary_link | sab | yes |
| cg | primary | cg | |
When I route I should get
| waypoints | route | turns | locations |
| s,f | sab,dbcef,dbcef | depart,turn right,arrive | s,a,f |
@sliproads
Scenario: Sliproad converted from a fork
Given the node map
"""
d
.
b
s . a '.
`c
.
f
"""
And the ways
| nodes | highway | name | ref | oneway |
| sa | tertiary | | D 60A | yes |
| ab | tertiary | ab | D 60A | yes |
| ac | tertiary | | D 60A | yes |
| dbcf | tertiary | dbcf | D 543 | yes |
When I route I should get
| waypoints | route | turns | locations |
| s,f | ,dbcf,dbcf | depart,turn right,arrive | s,a,f |
@sliproads
Scenario: Sliproad to a road with a reference only
Given the node map
"""
s . a . b . d
` .
' .
..
c
.
f
"""
And the ways
| nodes | highway | name | ref | oneway |
| sabd | primary | road | | |
| bcf | primary | | K108 | |
| ac | primary_link | | | yes |
When I route I should get
| waypoints | route | turns | locations |
| s,f | road,, | depart,turn right,arrive | s,a,f |
+10 -13
View File
@@ -745,15 +745,12 @@ Feature: Basic Roundabout
Scenario: Drive through roundabout
Given a grid size of 5 meters
Given the node map
"""
. a .
. .
b e --- d ---- f
. .
.c.
g h
a
b e d f
c
g h
"""
And the ways
@@ -763,12 +760,12 @@ Feature: Basic Roundabout
| gch | | yes |
When I route I should get
| waypoints | bearings | route | turns |
| e,f | 90 90 | edf,edf | depart,arrive |
| e,h | 90 130 | edf,gch,gch,gch | depart,roundabout-exit-2,exit roundabout straight,arrive |
| g,f | 50 90 | gch,edf,edf,edf | depart,roundabout-exit-2,exit roundabout slight right,arrive |
| g,h | 50 130 | gch,gch,gch | depart,exit roundabout right,arrive |
| e,e | 90 270 | edf,edf,edf,edf | depart,roundabout-exit-3,exit roundabout sharp left,arrive |
| waypoints | bearings | route | turns |
| e,f | 90 90 | edf,edf | depart,arrive |
| e,h | 90 135 | edf,gch,gch,gch | depart,roundabout-exit-2,exit roundabout straight,arrive |
| g,f | 45 90 | gch,edf,edf,edf | depart,roundabout-exit-2,exit roundabout right,arrive |
| g,h | 45 135 | gch,gch,gch | depart,exit roundabout right,arrive |
| e,e | 90 270 | edf,edf,edf | depart,continue uturn,arrive |
Scenario: CCW and CW roundabouts with overlaps
Given the node map
+6 -6
View File
@@ -53,12 +53,12 @@ template <typename Algorithm> class Engine final : public EngineInterface
{
public:
explicit Engine(const EngineConfig &config)
: route_plugin(config.max_locations_viaroute, config.max_alternatives), //
table_plugin(config.max_locations_distance_table), //
nearest_plugin(config.max_results_nearest), //
trip_plugin(config.max_locations_trip), //
match_plugin(config.max_locations_map_matching, config.max_radius_map_matching), //
tile_plugin() //
: route_plugin(config.max_locations_viaroute, config.max_alternatives), //
table_plugin(config.max_locations_distance_table), //
nearest_plugin(config.max_results_nearest), //
trip_plugin(config.max_locations_trip), //
match_plugin(config.max_locations_map_matching), //
tile_plugin() //
{
if (config.use_shared_memory)
-1
View File
@@ -84,7 +84,6 @@ struct EngineConfig final
int max_locations_viaroute = -1;
int max_locations_distance_table = -1;
int max_locations_map_matching = -1;
double max_radius_map_matching = -1.0;
int max_results_nearest = -1;
int max_alternatives = 3; // set an arbitrary upper bound; can be adjusted by user
bool use_shared_memory = true;
+2 -4
View File
@@ -24,9 +24,8 @@ class MatchPlugin : public BasePlugin
using CandidateLists = routing_algorithms::CandidateLists;
static const constexpr double RADIUS_MULTIPLIER = 3;
MatchPlugin(const int max_locations_map_matching, const double max_radius_map_matching)
: max_locations_map_matching(max_locations_map_matching),
max_radius_map_matching(max_radius_map_matching)
MatchPlugin(const int max_locations_map_matching)
: max_locations_map_matching(max_locations_map_matching)
{
}
@@ -36,7 +35,6 @@ class MatchPlugin : public BasePlugin
private:
const int max_locations_map_matching;
const double max_radius_map_matching;
};
}
}
@@ -44,6 +44,14 @@ inline auto makeCompareShapeDataByBearing(const double base_bearing)
};
}
inline auto makeCompareShapeDataAngleToBearing(const double base_bearing)
{
return [base_bearing](const auto &lhs, const auto &rhs) {
return util::bearing::angleBetween(lhs.bearing, base_bearing) <
util::bearing::angleBetween(rhs.bearing, base_bearing);
};
}
inline auto makeCompareAngularDeviation(const double angle)
{
return [angle](const auto &lhs, const auto &rhs) {
@@ -77,11 +77,7 @@ struct TurnInstruction
TurnType::Enum type : 5;
DirectionModifier::Enum direction_modifier : 3;
bool IsUTurn() const
{
return type != TurnType::NoTurn && direction_modifier == DirectionModifier::UTurn;
}
// the lane tupel that is used for the turn
static TurnInstruction INVALID() { return {TurnType::Invalid, DirectionModifier::UTurn}; }
-5
View File
@@ -186,8 +186,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
params->Get(Nan::New("max_locations_map_matching").ToLocalChecked());
auto max_results_nearest = params->Get(Nan::New("max_results_nearest").ToLocalChecked());
auto max_alternatives = params->Get(Nan::New("max_alternatives").ToLocalChecked());
auto max_radius_map_matching =
params->Get(Nan::New("max_radius_map_matching").ToLocalChecked());
if (!max_locations_trip->IsUndefined() && !max_locations_trip->IsNumber())
{
@@ -235,9 +233,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
engine_config->max_results_nearest = static_cast<int>(max_results_nearest->NumberValue());
if (max_alternatives->IsNumber())
engine_config->max_alternatives = static_cast<int>(max_alternatives->NumberValue());
if (max_radius_map_matching->IsNumber())
engine_config->max_radius_map_matching =
static_cast<double>(max_radius_map_matching->NumberValue());
return engine_config;
}
+63 -38
View File
@@ -26,8 +26,7 @@ namespace guidance
// Name Change Logic
// Used both during Extraction as well as during Post-Processing
inline util::StringView longest_common_substring(const util::StringView &lhs,
const util::StringView &rhs)
inline std::string longest_common_substring(const std::string &lhs, const std::string &rhs)
{
if (lhs.empty() || rhs.empty())
return "";
@@ -61,15 +60,15 @@ inline util::StringView longest_common_substring(const util::StringView &lhs,
// TODO US-ASCII support only, no UTF-8 support
// While UTF-8 might work in some cases, we do not guarantee full functionality
template <typename StringView> inline auto decompose(const StringView &lhs, const StringView &rhs)
inline auto decompose(const std::string &lhs, const std::string &rhs)
{
auto const lcs = longest_common_substring(lhs, rhs);
// trim spaces, transform to lower
const auto trim = [](StringView view) {
const auto trim = [](auto str) {
// we compare suffixes based on this value, it might break UTF chars, but as long as we are
// consistent in handling, we do not create bad results
std::string str = boost::to_lower_copy(view.to_string());
boost::to_lower(str);
auto front = str.find_first_not_of(" ");
if (front == std::string::npos)
@@ -81,7 +80,8 @@ template <typename StringView> inline auto decompose(const StringView &lhs, cons
if (lcs.empty())
{
return std::make_tuple(trim(lhs), trim(rhs), std::string(), std::string());
std::string empty = "";
return std::make_tuple(trim(lhs), trim(rhs), empty, empty);
}
// find the common substring in both
@@ -92,27 +92,32 @@ template <typename StringView> inline auto decompose(const StringView &lhs, cons
BOOST_ASSERT(rhs_pos + lcs.size() <= rhs.size());
// prefixes
auto lhs_prefix = (lhs_pos > 0) ? lhs.substr(0, lhs_pos) : StringView();
auto rhs_prefix = (rhs_pos > 0) ? rhs.substr(0, rhs_pos) : StringView();
std::string lhs_prefix = (lhs_pos > 0) ? lhs.substr(0, lhs_pos) : "";
std::string rhs_prefix = (rhs_pos > 0) ? rhs.substr(0, rhs_pos) : "";
// suffices
auto lhs_suffix = lhs.substr(lhs_pos + lcs.size());
auto rhs_suffix = rhs.substr(rhs_pos + lcs.size());
std::string lhs_suffix = lhs.substr(lhs_pos + lcs.size());
std::string rhs_suffix = rhs.substr(rhs_pos + lcs.size());
return std::make_tuple(trim(lhs_prefix), trim(lhs_suffix), trim(rhs_prefix), trim(rhs_suffix));
lhs_prefix = trim(std::move(lhs_prefix));
lhs_suffix = trim(std::move(lhs_suffix));
rhs_prefix = trim(std::move(rhs_prefix));
rhs_suffix = trim(std::move(rhs_suffix));
return std::make_tuple(lhs_prefix, lhs_suffix, rhs_prefix, rhs_suffix);
}
// Note: there is an overload without suffix checking below.
// (that's the reason we template the suffix table here)
template <typename StringView, typename SuffixTable>
inline bool requiresNameAnnounced(const StringView &from_name,
const StringView &from_ref,
const StringView &from_pronunciation,
const StringView &from_exits,
const StringView &to_name,
const StringView &to_ref,
const StringView &to_pronunciation,
const StringView &to_exits,
template <typename SuffixTable>
inline bool requiresNameAnnounced(const std::string &from_name,
const std::string &from_ref,
const std::string &from_pronunciation,
const std::string &from_exits,
const std::string &to_name,
const std::string &to_ref,
const std::string &to_pronunciation,
const std::string &to_exits,
const SuffixTable &suffix_table)
{
// first is empty and the second is not
@@ -129,7 +134,7 @@ inline bool requiresNameAnnounced(const StringView &from_name,
boost::starts_with(from_name, to_name) || boost::starts_with(to_name, from_name);
const auto checkForPrefixOrSuffixChange =
[](const StringView &first, const StringView &second, const SuffixTable &suffix_table) {
[](const std::string &first, const std::string &second, const SuffixTable &suffix_table) {
std::string first_prefix, first_suffix, second_prefix, second_suffix;
std::tie(first_prefix, first_suffix, second_prefix, second_suffix) =
decompose(first, second);
@@ -198,17 +203,17 @@ inline bool requiresNameAnnounced(const std::string &from_name,
struct NopSuffixTable final
{
NopSuffixTable() {}
bool isSuffix(const StringView &) const { return false; }
bool isSuffix(const std::string &) const { return false; }
} static const table;
return requiresNameAnnounced(util::StringView(from_name),
util::StringView(from_ref),
util::StringView(from_pronunciation),
util::StringView(from_exits),
util::StringView(to_name),
util::StringView(to_ref),
util::StringView(to_pronunciation),
util::StringView(to_exits),
return requiresNameAnnounced(from_name,
from_ref,
from_pronunciation,
from_exits,
to_name,
to_ref,
to_pronunciation,
to_exits,
table);
}
@@ -220,17 +225,37 @@ inline bool requiresNameAnnounced(const NameID from_name_id,
if (from_name_id == to_name_id)
return false;
else
return requiresNameAnnounced(name_table.GetNameForID(from_name_id),
name_table.GetRefForID(from_name_id),
name_table.GetPronunciationForID(from_name_id),
name_table.GetExitsForID(from_name_id),
return requiresNameAnnounced(name_table.GetNameForID(from_name_id).to_string(),
name_table.GetRefForID(from_name_id).to_string(),
name_table.GetPronunciationForID(from_name_id).to_string(),
name_table.GetExitsForID(from_name_id).to_string(),
//
name_table.GetNameForID(to_name_id),
name_table.GetRefForID(to_name_id),
name_table.GetPronunciationForID(to_name_id),
name_table.GetExitsForID(to_name_id),
name_table.GetNameForID(to_name_id).to_string(),
name_table.GetRefForID(to_name_id).to_string(),
name_table.GetPronunciationForID(to_name_id).to_string(),
name_table.GetExitsForID(to_name_id).to_string(),
//
suffix_table);
// FIXME: converts StringViews to strings since the name change heuristics mutates in place
}
inline bool requiresNameAnnounced(const NameID from_name_id,
const NameID to_name_id,
const util::NameTable &name_table)
{
if (from_name_id == to_name_id)
return false;
else
return requiresNameAnnounced(name_table.GetNameForID(from_name_id).to_string(),
name_table.GetRefForID(from_name_id).to_string(),
name_table.GetPronunciationForID(from_name_id).to_string(),
name_table.GetExitsForID(from_name_id).to_string(),
//
name_table.GetNameForID(to_name_id).to_string(),
name_table.GetRefForID(to_name_id).to_string(),
name_table.GetExitsForID(to_name_id).to_string(),
name_table.GetPronunciationForID(to_name_id).to_string());
// FIXME: converts StringViews to strings since the name change heuristics mutates in place
}
} // namespace guidance
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "osrm",
"version": "5.15.0-latest.4",
"version": "5.15.0-latest.2",
"private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": {
+1 -8
View File
@@ -37,10 +37,6 @@ function setup()
turn_bias = 1.075,
cardinal_directions = false,
-- Size of the vehicle, to be limited by physical restriction of the way
vehicle_height = 2.5, -- in metters, 2.5m is the height of van
vehicle_width = 1.9, -- in metters, ways with narrow tag are considered narrower than 2.2m
-- a list of suffixes to suppress in name change instructions. The suffixes also include common substrings of each other
suffix_list = {
'N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'North', 'South', 'West', 'East', 'Nor', 'Sou', 'We', 'Ea'
@@ -257,8 +253,6 @@ function setup()
["at:rural"] = 100,
["at:trunk"] = 100,
["be:motorway"] = 120,
["by:urban"] = 60,
["by:motorway"] = 110,
["ch:rural"] = 80,
["ch:trunk"] = 100,
["ch:motorway"] = 120,
@@ -282,6 +276,7 @@ function setup()
["ru:living_street"] = 20,
["ru:urban"] = 60,
["ru:motorway"] = 110,
["ua:urban"] = 60,
["uk:nsl_single"] = (60*1609)/1000,
["uk:nsl_dual"] = (70*1609)/1000,
["uk:motorway"] = (70*1609)/1000,
@@ -362,8 +357,6 @@ function process_way(profile, way, result, relations)
-- toll=yes and oneway=reversible
WayHandlers.blocked_ways,
WayHandlers.avoid_ways,
WayHandlers.handle_height,
WayHandlers.handle_width,
-- determine access status by checking our hierarchy of
-- access tags, e.g: motorcar, motor_vehicle, vehicle
-87
View File
@@ -1,87 +0,0 @@
local Sequence = require('lib/sequence')
Measure = {}
-- measurements conversion constants
local inch_to_meters = 0.0254
local feet_to_inches = 12
--- Parse string as a height in meters.
--- according to http://wiki.openstreetmap.org/wiki/Key:maxheight
function Measure.parse_value_meters(value)
local n = tonumber(value:gsub(",", "."):match("%d+%.?%d*"))
if n then
inches = value:match("'.*")
if inches then -- Imperial unit to metric
-- try to parse feets/inch
n = n * feet_to_inches
local m = tonumber(inches:match("%d+"))
if m then
n = n + m
end
n = n * inch_to_meters
end
return n
end
print("Can't parse value: ", value)
end
--- according to http://wiki.openstreetmap.org/wiki/Map_Features/Units#Explicit_specifications
local tonns_parse_patterns = Sequence {
"%d+",
"%d+.%d+",
"%d+.%d+ ?t"
}
local kg_parse_patterns = Sequence {
"%d+ ?kg"
}
--- Parse weight value in kilograms
function Measure.parse_value_kilograms(value)
-- try to parse kilograms
for i, templ in ipairs(kg_parse_patterns) do
m = string.match(value, templ)
if m then
return tonumber(m)
end
end
-- try to parse tonns
for i, templ in ipairs(tonns_parse_patterns) do
m = string.match(value, templ)
if m then
return tonumber(m) * 1000
end
end
--
print("Can't parse value: ", value)
return
end
--- Get maxheight of specified way in meters. If there are no
--- max height, then return nil
function Measure.get_max_height(raw_value)
if raw_value then
return Measure.parse_value_meters(raw_value)
end
end
--- Get maxwidth of specified way in meters.
function Measure.get_max_width(raw_value)
if raw_value then
return Measure.parse_value_meters(raw_value)
end
end
--- Get maxweight of specified way in kilogramms
function Measure.get_max_weight(raw_value)
if raw_value then
return Measure.parse_value_kilograms(raw_value)
end
end
return Measure;
-42
View File
@@ -8,7 +8,6 @@ local get_turn_lanes = require("lib/guidance").get_turn_lanes
local set_classification = require("lib/guidance").set_classification
local get_destination = require("lib/destination").get_destination
local Tags = require('lib/tags')
local Measure = require("lib/measure")
WayHandlers = {}
@@ -430,47 +429,6 @@ function WayHandlers.parse_maxspeed(source,profile)
return n
end
-- handle maxheight tags
function WayHandlers.handle_height(profile,way,result,data)
local keys = Sequence { 'maxheight:physical', 'maxheight' }
local forward, backward = Tags.get_forward_backward_by_set(way,data,keys)
forward = Measure.get_max_height(forward)
backward = Measure.get_max_height(backward)
if forward and forward < profile.vehicle_height then
result.forward_mode = mode.inaccessible
end
if backward and backward < profile.vehicle_height then
result.backward_mode = mode.inaccessible
end
end
-- handle maxwidth tags
function WayHandlers.handle_width(profile,way,result,data)
local keys = Sequence { 'maxwidth:physical', 'maxwidth', 'width', 'est_width' }
local forward, backward = Tags.get_forward_backward_by_set(way,data,keys)
local narrow = way:get_value_by_key('narrow')
if ((forward and forward == 'narrow') or (narrow and narrow == 'yes')) and profile.vehicle_width > 2.2 then
result.forward_mode = mode.inaccessible
elseif forward then
forward = Measure.get_max_width(forward)
if forward and forward <= profile.vehicle_width then
result.forward_mode = mode.inaccessible
end
end
if ((backward and backward == 'narrow') or (narrow and narrow == 'yes')) and profile.vehicle_width > 2.2 then
result.backward_mode = mode.inaccessible
elseif backward then
backward = Measure.get_max_width(backward)
if backward and backward <= profile.vehicle_width then
result.backward_mode = mode.inaccessible
end
end
end
-- handle oneways tags
function WayHandlers.oneway(profile,way,result,data)
if not profile.oneway_handling then
+2 -2
View File
@@ -71,10 +71,10 @@ def build_pretty_printer():
pp.add_printer('TurnLaneData', '::TurnLaneData$', TurnLaneDataPrinter)
return pp
## unregister OSRM pretty printer before (re)loading
gdb.pretty_printers = [x for x in gdb.pretty_printers if not isinstance(x, gdb.printing.RegexpCollectionPrettyPrinter) or x.name != 'OSRM']
gdb.pretty_printers = [x for x in gdb.pretty_printers if x.name != 'OSRM'] # unregister OSRM pretty printer before (re)loading
gdb.printing.register_pretty_printer(gdb.current_objfile(), build_pretty_printer())
import geojson
import os
import time
+1 -2
View File
@@ -11,13 +11,12 @@ bool EngineConfig::IsValid() const
// leads to an empty path
const bool all_path_are_empty = storage_config.GetPath("").empty();
const auto unlimited_or_more_than = [](const auto v, const auto limit) {
const auto unlimited_or_more_than = [](const int v, const int limit) {
return v == -1 || v > limit;
};
const bool limits_valid = unlimited_or_more_than(max_locations_distance_table, 2) &&
unlimited_or_more_than(max_locations_map_matching, 2) &&
unlimited_or_more_than(max_radius_map_matching, 0) &&
unlimited_or_more_than(max_locations_trip, 2) &&
unlimited_or_more_than(max_locations_viaroute, 2) &&
unlimited_or_more_than(max_results_nearest, 0) &&
-11
View File
@@ -139,17 +139,6 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
return Error("InvalidValue", "Invalid coordinate value.", json_result);
}
if (max_radius_map_matching > 0 && std::any_of(parameters.radiuses.begin(),
parameters.radiuses.end(),
[&](const auto &radius) {
if (!radius)
return false;
return *radius > max_radius_map_matching;
}))
{
return Error("TooBig", "Radius search size is too large for map matching.", json_result);
}
// Check for same or increasing timestamps. Impl. note: Incontrast to `sort(first,
// last, less_equal)` checking `greater` in reverse meets irreflexive requirements.
const auto time_increases_monotonically = std::is_sorted(
+2 -4
View File
@@ -377,9 +377,7 @@ EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const WayRestrictionMap &way_re
m_edge_based_node_container.nodes[edge_based_node_id].segregated =
segregated_edges.count(eid) > 0;
const auto ebn_weight = m_edge_based_node_weights[nbe_to_ebn_mapping[eid]];
BOOST_ASSERT(ebn_weight == INVALID_EDGE_WEIGHT || ebn_weight == edge_data.weight);
m_edge_based_node_weights.push_back(ebn_weight);
m_edge_based_node_weights.push_back(m_edge_based_node_weights[eid]);
edge_based_node_id++;
progress.PrintStatus(progress_counter++);
@@ -601,7 +599,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
ExtractionTurn extracted_turn(
turn.angle,
m_node_based_graph.GetOutDegree(intersection_node),
turn.instruction.IsUTurn(),
turn.instruction.direction_modifier == guidance::DirectionModifier::UTurn,
is_traffic_light,
edge_data1.flags.restricted,
edge_data2.flags.restricted,
+5 -1
View File
@@ -487,7 +487,10 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
// Name mismatch: check roads at `c` and `d` for same name
const auto name_mismatch = [&](const NameID road_name_id) {
return util::guidance::requiresNameAnnounced(road_name_id, //
const auto unnamed = name_table.GetNameForID(road_name_id).empty();
return unnamed ||
util::guidance::requiresNameAnnounced(road_name_id, //
candidate_data.name_id, //
name_table, //
street_name_suffix_table); //
@@ -598,6 +601,7 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
}
else if (!name_table.GetNameForID(main_annotation.name_id).empty())
{
OSRM_ASSERT(false, node_coordinates[intersection_node_id]);
intersection[*obvious].instruction.type = TurnType::NewName;
intersection[*obvious].instruction.direction_modifier =
getTurnDirection(intersection[*obvious].angle);
+1 -2
View File
@@ -76,9 +76,8 @@ NAN_MODULE_INIT(Engine::Init)
* @param {Number} [options.max_locations_viaroute] Max. locations supported in viaroute query (default: unlimited).
* @param {Number} [options.max_locations_distance_table] Max. locations supported in distance table query (default: unlimited).
* @param {Number} [options.max_locations_map_matching] Max. locations supported in map-matching query (default: unlimited).
* @param {Number} [options.max_radius_map_matching] Max. radius size supported in map matching query (default: 5).
* @param {Number} [options.max_results_nearest] Max. results supported in nearest query (default: unlimited).
* @param {Number} [options.max_alternatives] Max. number of alternatives supported in alternative routes query (default: 3).
* @param {Number} [options.max_alternatives] Max.number of alternatives supported in alternative routes query (default: 3).
*
* @class OSRM
*
+1 -4
View File
@@ -133,10 +133,7 @@ inline unsigned generateServerProgramOptions(const int argc,
"Max. results supported in nearest query") //
("max-alternatives",
value<int>(&config.max_alternatives)->default_value(3),
"Max. number of alternatives supported in the MLD route query") //
("max-matching-radius",
value<double>(&config.max_radius_map_matching)->default_value(5),
"Max. radius size supported in map matching query");
"Max. number of alternatives supported in the MLD route query");
// hidden options, will be allowed on command line, but will not be shown to the user
boost::program_options::options_description hidden_options("Hidden options");
+1 -2
View File
@@ -147,8 +147,6 @@
{"key": "maxspeed", "value": "AT:rural"},
{"key": "maxspeed", "value": "AT:trunk"},
{"key": "maxspeed", "value": "BE:motorway"},
{"key": "maxspeed", "value": "BY:urban"},
{"key": "maxspeed", "value": "BY:motorway"},
{"key": "maxspeed", "value": "CH:rural"},
{"key": "maxspeed", "value": "CH:trunk"},
{"key": "maxspeed", "value": "CH:motorway"},
@@ -172,6 +170,7 @@
{"key": "maxspeed", "value": "RU:living_street"},
{"key": "maxspeed", "value": "RU:urban"},
{"key": "maxspeed", "value": "RU:motorway"},
{"key": "maxspeed", "value": "UA:urban"},
{"key": "maxspeed", "value": "UK:nsl_single"},
{"key": "maxspeed", "value": "UK:nsl_dual"},
{"key": "maxspeed", "value": "UK:motorway"},
+1 -33
View File
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(test_table_limits)
BOOST_CHECK(code == "TooBig"); // per the New-Server API spec
}
BOOST_AUTO_TEST_CASE(test_match_coordinate_limits)
BOOST_AUTO_TEST_CASE(test_match_limits)
{
using namespace osrm;
@@ -131,38 +131,6 @@ BOOST_AUTO_TEST_CASE(test_match_coordinate_limits)
BOOST_CHECK(code == "TooBig"); // per the New-Server API spec
}
BOOST_AUTO_TEST_CASE(test_match_radiuses_limits)
{
using namespace osrm;
EngineConfig config;
config.storage_config = {OSRM_TEST_DATA_DIR "/ch/monaco.osrm"};
config.use_shared_memory = false;
config.max_radius_map_matching = 2.0;
OSRM osrm{config};
MatchParameters params;
osrm::util::Coordinate coord1 = {osrm::util::FloatLongitude{7.41748809814453},
osrm::util::FloatLatitude{43.73558473009846}};
osrm::util::Coordinate coord2 = {osrm::util::FloatLongitude{7.417193055152893},
osrm::util::FloatLatitude{43.735162245104775}};
params.coordinates.emplace_back(coord1);
params.coordinates.emplace_back(coord2);
params.radiuses.emplace_back(3.0);
params.radiuses.emplace_back(2.0);
json::Object result;
const auto rc = osrm.Match(params, result);
BOOST_CHECK(rc == Status::Error);
// Make sure we're not accidentally hitting a guard code path before
const auto code = result.values["code"].get<json::String>().value;
BOOST_CHECK(code == "TooBig"); // per the New-Server API spec
}
BOOST_AUTO_TEST_CASE(test_nearest_limits)
{
using namespace osrm;
+2 -16
View File
@@ -74,6 +74,8 @@ BOOST_AUTO_TEST_CASE(invalid_route_urls)
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4?annotations=true,false"), 24UL);
BOOST_CHECK_EQUAL(
testInvalidOptions<RouteParameters>("1,2;3,4?annotations=&overview=simplified"), 20UL);
// BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>(), );
}
BOOST_AUTO_TEST_CASE(invalid_table_urls)
@@ -557,22 +559,6 @@ BOOST_AUTO_TEST_CASE(valid_match_urls)
CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates);
}
BOOST_AUTO_TEST_CASE(invalid_match_urls)
{
std::vector<util::Coordinate> coords_1 = {{util::FloatLongitude{1}, util::FloatLatitude{2}},
{util::FloatLongitude{3}, util::FloatLatitude{4}}};
MatchParameters reference_1{};
reference_1.coordinates = coords_1;
auto result_1 = parseParameters<MatchParameters>("1,2;3,4?radiuses=unlimited;60");
BOOST_CHECK(result_1);
CHECK_EQUAL_RANGE(reference_1.timestamps, result_1->timestamps);
CHECK_EQUAL_RANGE(reference_1.bearings, result_1->bearings);
BOOST_CHECK(reference_1.radiuses != result_1->radiuses);
CHECK_EQUAL_RANGE(reference_1.approaches, result_1->approaches);
CHECK_EQUAL_RANGE(reference_1.coordinates, result_1->coordinates);
}
BOOST_AUTO_TEST_CASE(valid_nearest_urls)
{
std::vector<util::Coordinate> coords_1 = {{util::FloatLongitude{1}, util::FloatLatitude{2}}};