Compare commits

...

14 Commits

Author SHA1 Message Date
Moritz Kobitzsch 1ae2964b0f fix roundabout-intersection on immediate exit 2016-09-13 19:28:20 +02:00
Moritz Kobitzsch 237e8e02fd prepare 5.4.0-rc.2 2016-09-13 14:40:14 +02:00
Moritz Kobitzsch 865052352e fix false positives in sliproads 2016-09-13 14:37:25 +02:00
Moritz Kobitzsch 2064d6b2ce also reserve entry for refs 2016-09-13 14:01:13 +02:00
Daniel Patterson 6c9227d4d0 Update changelog for issue #2896 fix. 2016-09-12 15:15:04 -07:00
Michael Krasnyk ef66e271c1 Test for PR #2898
Test checks that osrm-extract terminates for
http://www.openstreetmap.org/way/198481519
2016-09-12 15:12:34 -07:00
Moritz Kobitzsch 7c3b587028 fix looping in sliproad handler for lanes 2016-09-12 18:34:28 +02:00
Daniel J. Hofmann d399014633 Adds a limit for number of results returned in Nearest service, resolves #2872 2016-09-12 12:08:49 +02:00
Daniel J. Hofmann e27ce0e518 Fixes issue where two ways with same name but different pronunciation where deduplicated, resolves #2860 2016-09-12 11:01:51 +02:00
Daniel J. Hofmann 1a1e16c5b4 We do duration based routing (also see #77); closes #2885 2016-09-09 16:27:58 +02:00
Daniel J. Hofmann 01e7232add Fixes compilation against newer Boost versions; seems like we were lucky before; closes #2889 2016-09-09 16:15:21 +02:00
Moritz Kobitzsch c69f99f282 make sure to reserve enough external memory 2016-09-09 15:55:57 +02:00
Daniel J. Hofmann 391163cba0 Fixes bearing range of zero exhaustive graph traversal 2016-09-08 17:38:40 +02:00
Moritz Kobitzsch 4cddec298f prepare 5.4.0-rc.1 2016-09-08 16:56:11 +02:00
26 changed files with 251 additions and 35 deletions
+1
View File
@@ -13,6 +13,7 @@ notifications:
branches:
only:
- master
- 5.4
cache:
ccache: true
+16
View File
@@ -1,3 +1,14 @@
# 5.4.0-rc.4
Changes from 5.4.0-rc.3
- Bugfixes
- Fixed a bug where roundabout intersections could result in breaking assertions when immediately exited
# 5.4.0-rc.3
Changes from 5.4.0-rc.2
- Bugfixes
- BREAKING: Fixed a bug where some roads could be falsly identified as sliproadsi This change requires reprocessing datasets with osrm-extract and osrm-contract
- BREAKING: Fixed a bug that resulted in false names/ref/destination/pronunciation This change requires reprocessing datasets with osrm-extract and osrm-contract
# 5.4.0
Changes from 5.3.0
- Profiles
@@ -20,6 +31,11 @@
- Fixed an issue that could emit `invalid` as instruction when ending on a sliproad after a traffic-light
- Fixed an issue that would detect turning circles as sliproads
- Fixed a bug where post-processing instructions (e.g. left + left -> uturn) could result in false pronunciations
- Fixes a bug where a bearing range of zero would cause exhaustive graph traversals
- Fixes a bug where certain looped geometries could cause an infinite loop during extraction
- Infrastructure:
- Adds a feature to limit results in nearest service with a default of 100 in `osrm-routed`
# 5.3.0
Changes from 5.3.0-rc.3
+1 -1
View File
@@ -9,7 +9,7 @@ endif()
project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 3)
set(OSRM_VERSION_MINOR 4)
set(OSRM_VERSION_PATCH 0)
# these two functions build up custom variables:
+3 -3
View File
@@ -30,11 +30,11 @@ http://{server}/{service}/{version}/{profile}/{coordinates}[.{format}]?option=va
| Service | Description |
|-------------|-----------------------------------------------------------|
| [`route`](#service-route) | shortest path between given coordinates |
| [`route`](#service-route) | fastest path between given coordinates |
| [`nearest`](#service-nearest) | returns the nearest street segment for a given coordinate |
| [`table`](#service-table) | computes distance tables for given coordinates |
| [`match`](#service-match) | matches given coordinates to the road network |
| [`trip`](#service-trip) | Compute the shortest round trip between given coordinates |
| [`trip`](#service-trip) | Compute the fastest round trip between given coordinates |
| [`tile`](#service-tile) | Return vector tiles containing debugging info |
- `version`: Version of the protocol implemented by the service.
@@ -302,7 +302,7 @@ All other fields might be undefined.
## Service `trip`
The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm).
The returned path does not have to be the shortest path, as TSP is NP-hard it is only an approximation.
The returned path does not have to be the fastest path, as TSP is NP-hard it is only an approximation.
Note that if the input coordinates can not be joined by a single trip (e.g. the coordinates are on several disconnected islands)
multiple trips for each connected component are returned.
+17
View File
@@ -35,6 +35,23 @@ Feature: Car - Street names in instructions
| a | d | My Way,My Way | ,meyeway | ,A1 |
| 1 | c | Your Way,Your Way | yourewaye,yourewaye | , |
# See #2860
Scenario: Car - same street name but different pronunciation
Given the node map
| a | b | c |
| | d | |
| | e | |
And the ways
| nodes | name | name:pronunciation |
| abc | Houston St | hew-stun |
| bde | Houston St | how-stun |
When I route I should get
| from | to | route | pronunciations |
| a | c | Houston St,Houston St | hew-stun,hew-stun |
| a | e | Houston St,Houston St,Houston St | hew-stun,how-stun,how-stun |
@todo
Scenario: Car - Use way type to describe unnamed ways
Given the node map
+16
View File
@@ -218,3 +218,19 @@ Feature: Turn Lane Guidance
| a,h | ghough,market,market | depart,turn slight right,arrive | ,none:false straight:false straight:true straight:true, |
| a,j | ghough,market,market | depart,turn left,arrive | ,none:true straight:false straight:false straight:false, |
| a,f | ghough,ghough,ghough | depart,continue slight left,arrive | ,none:true straight:true straight:false straight:false, |
Scenario: Check sliproad handler loop's exit condition, Issue #2896
# http://www.openstreetmap.org/way/198481519
Given the node locations
| node | lat | lon |
| a | 7.6125350 | 126.5708309 |
| b | 7.6125156 | 126.5707219 |
| c | 7.6125363 | 126.5708337 |
And the ways
| nodes | name |
| cbac | |
When I route I should get
| from | to | route | turns |
| a | c | , | depart,arrive |
@@ -264,3 +264,52 @@ Feature: Slipways and Dedicated Turn Lanes
When I route I should get
| waypoints | bearings | route | turns |
| b,a | 90,10 270,10 | circled,circled | depart,arrive |
#http://www.openstreetmap.org/#map=19/38.90597/-77.01276
Scenario: Don't falsly classify as sliproads
Given the node map
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| | | | | | | | | | | | | | | | | | | | | | | | j | | | | | | | |
| a | b | | | | | | | | | | | | | | | | | | | | | | c | | | | | | | d |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | e | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | 1 | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | f | | | | | g | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | i | | | | | | | h |
And the ways
| nodes | name | highway | oneway | maxspeed |
| abcd | new york | primary | yes | 35 |
| befgh | m street | secondary | yes | 35 |
| igcj | 1st street | tertiary | no | 20 |
And the nodes
| node | highway |
| c | traffic_signals |
| g | traffic_signals |
When I route I should get
| waypoints | route | turns | # |
| a,d | new york,new york | depart,arrive | this is the sinatra route |
| a,j | new york,1st street,1st street | depart,turn left,arrive | |
| a,1 | new york,m street,1st street,1st street | depart,turn right,turn left,arrive | this can false be seen as a sliproad |
+20
View File
@@ -491,3 +491,23 @@ Feature: Basic Roundabout
| h,a | gh,ab,ab | depart,roundabout turn left exit-3,arrive |
| h,d | gh,cd,cd | depart,roundabout turn straight exit-2,arrive |
| h,f | gh,ef,ef | depart,roundabout turn right exit-1,arrive |
#http://www.openstreetmap.org/#map=19/41.03275/-2.18990
#at some point we probably want to recognise these situations and don't mention the roundabout at all here
Scenario: Enter And Exit Throughabout
Given the node map
| | | | | | h | | | | |
| | | | | | | | | | |
| c | b | | d | | | | e | | f |
| | | | | | | | | | |
| | a | | | | g | | | | |
And the ways
| nodes | highway | name | junction | oneway |
| dghd | tertiary_link | | roundabout | |
| cbdef | trunk | through | | no |
| ab | residential | in | | |
When I route I should get
| waypoints | turns | route |
| a,f | depart,turn right,roundabout turn straight exit-1,arrive | in,through,through,through |
+2
View File
@@ -51,6 +51,7 @@ namespace engine
* - Route
* - Table
* - Match
* - Nearest
*
* In addition, shared memory can be used for datasets loaded with osrm-datastore.
*
@@ -65,6 +66,7 @@ struct EngineConfig final
int max_locations_viaroute = -1;
int max_locations_distance_table = -1;
int max_locations_map_matching = -1;
int max_results_nearest = -1;
bool use_shared_memory = true;
};
}
+4 -1
View File
@@ -15,9 +15,12 @@ namespace plugins
class NearestPlugin final : public BasePlugin
{
public:
explicit NearestPlugin(datafacade::BaseDataFacade &facade);
explicit NearestPlugin(datafacade::BaseDataFacade &facade, const int max_results);
Status HandleRequest(const api::NearestParameters &params, util::json::Object &result);
private:
const int max_results;
};
}
}
+8 -4
View File
@@ -18,14 +18,17 @@ class Way;
namespace std
{
template <> struct hash<std::tuple<std::string, std::string, std::string>>
template <> struct hash<std::tuple<std::string, std::string, std::string, std::string>>
{
std::size_t operator()(const std::tuple<std::string, std::string, std::string> &mk) const noexcept
std::size_t
operator()(const std::tuple<std::string, std::string, std::string, std::string> &mk) const
noexcept
{
std::size_t seed = 0;
boost::hash_combine(seed, std::get<0>(mk));
boost::hash_combine(seed, std::get<1>(mk));
boost::hash_combine(seed, std::get<2>(mk));
boost::hash_combine(seed, std::get<3>(mk));
return seed;
}
};
@@ -51,8 +54,9 @@ struct ExtractionWay;
class ExtractorCallbacks
{
private:
// used to deduplicate street names and street destinations: actually maps to name ids
using MapKey = std::tuple<std::string, std::string, std::string>;
// used to deduplicate street names, refs, destinations, pronunciation: actually maps to name
// ids
using MapKey = std::tuple<std::string, std::string, std::string, std::string>;
using MapVal = unsigned;
std::unordered_map<MapKey, MapVal> string_map;
guidance::LaneDescriptionMap lane_description_map;
+1 -1
View File
@@ -67,7 +67,7 @@ inline bool CheckInBounds(const int A, const int B, const int range)
if (range >= 180)
return true;
if (range <= 0)
if (range < 0)
return false;
// Map both bearings into positive modulo 360 space
+1 -1
View File
@@ -113,7 +113,7 @@ inline bool entersRoundabout(const extractor::guidance::TurnInstruction instruct
instruction.type == extractor::guidance::TurnType::EnterRoundaboutIntersectionAtExit ||
instruction.type == extractor::guidance::TurnType::EnterAndExitRoundabout ||
instruction.type == extractor::guidance::TurnType::EnterAndExitRotary ||
instruction.type == extractor::guidance::TurnType::EnterAndExitRotary);
instruction.type == extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection);
}
inline bool leavesRoundabout(const extractor::guidance::TurnInstruction instruction)
+1
View File
@@ -17,6 +17,7 @@
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/format.hpp>
#include <boost/iostreams/device/mapped_file.hpp>
#include <tbb/parallel_for.h>
+2 -1
View File
@@ -235,7 +235,8 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
route_step.values["distance"] = std::round(step.distance * 10) / 10.;
route_step.values["duration"] = std::round(step.duration * 10) / 10.;
route_step.values["name"] = std::move(step.name);
if (!step.ref.empty()) route_step.values["ref"] = std::move(step.ref);
if (!step.ref.empty())
route_step.values["ref"] = std::move(step.ref);
if (!step.pronunciation.empty())
route_step.values["pronunciation"] = std::move(step.pronunciation);
if (!step.destinations.empty())
+1 -1
View File
@@ -146,7 +146,7 @@ Engine::Engine(EngineConfig &config)
route_plugin = create<ViaRoutePlugin>(*query_data_facade, config.max_locations_viaroute);
table_plugin = create<TablePlugin>(*query_data_facade, config.max_locations_distance_table);
nearest_plugin = create<NearestPlugin>(*query_data_facade);
nearest_plugin = create<NearestPlugin>(*query_data_facade, config.max_results_nearest);
trip_plugin = create<TripPlugin>(*query_data_facade, config.max_locations_trip);
match_plugin = create<MatchPlugin>(*query_data_facade, config.max_locations_map_matching);
tile_plugin = create<TilePlugin>(*query_data_facade);
+9 -5
View File
@@ -15,11 +15,15 @@ bool EngineConfig::IsValid() const
storage_config.datasource_names_path.empty() &&
storage_config.datasource_indexes_path.empty() && storage_config.names_data_path.empty();
const bool limits_valid =
(max_locations_distance_table == -1 || max_locations_distance_table > 2) &&
(max_locations_map_matching == -1 || max_locations_map_matching > 2) &&
(max_locations_trip == -1 || max_locations_trip > 2) &&
(max_locations_viaroute == -1 || max_locations_viaroute > 2);
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_locations_trip, 2) &&
unlimited_or_more_than(max_locations_viaroute, 2) &&
unlimited_or_more_than(max_results_nearest, 0);
return ((use_shared_memory && all_path_are_empty) || storage_config.IsValid()) && limits_valid;
}
+4 -1
View File
@@ -1,5 +1,5 @@
#include "engine/guidance/post_processing.hpp"
#include "extractor/guidance/turn_instruction.hpp"
#include "engine/guidance/post_processing.hpp"
#include "engine/guidance/assemble_steps.hpp"
#include "engine/guidance/lane_processing.hpp"
@@ -203,6 +203,8 @@ bool setUpRoundabout(RouteStep &step)
instruction.type == TurnType::EnterRoundaboutAtExit ||
instruction.type == TurnType::EnterRoundaboutIntersectionAtExit)
{
// Here we consider an actual entry, not an exit. We simply have to count the additional
// exit
step.maneuver.exit = 1;
// prevent futher special case handling of these two.
if (instruction.type == TurnType::EnterRotaryAtExit)
@@ -215,6 +217,7 @@ bool setUpRoundabout(RouteStep &step)
if (leavesRoundabout(instruction))
{
// This set-up, even though it looks the same, is actually looking at entering AND exiting
step.maneuver.exit = 1; // count the otherwise missing exit
// prevent futher special case handling of these two.
+12 -1
View File
@@ -16,13 +16,24 @@ namespace engine
namespace plugins
{
NearestPlugin::NearestPlugin(datafacade::BaseDataFacade &facade) : BasePlugin{facade} {}
NearestPlugin::NearestPlugin(datafacade::BaseDataFacade &facade, const int max_results_)
: BasePlugin{facade}, max_results{max_results_}
{
}
Status NearestPlugin::HandleRequest(const api::NearestParameters &params,
util::json::Object &json_result)
{
BOOST_ASSERT(params.IsValid());
if (params.number_of_results > max_results)
{
return Error("TooBig",
"Number of results " + std::to_string(params.number_of_results) +
" is higher than current maximum (" + std::to_string(max_results) + ")",
json_result);
}
if (!CheckAllCoordinates(params.coordinates))
return Error("InvalidOptions", "Coordinates are invalid", json_result);
+2 -1
View File
@@ -110,7 +110,8 @@ ExtractionContainers::ExtractionContainers()
// Check if stxxl can be instantiated
stxxl::vector<unsigned> dummy_vector;
// Insert three empty strings offsets for name, destination and pronunciation
// Insert three empty strings offsets for name, ref, destination and pronunciation
name_offsets.push_back(0);
name_offsets.push_back(0);
name_offsets.push_back(0);
name_offsets.push_back(0);
+10 -7
View File
@@ -34,8 +34,8 @@ namespace TurnLaneType = guidance::TurnLaneType;
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers)
: external_memory(extraction_containers)
{
// we reserved 0, 1, 2 for the empty case
string_map[MapKey("", "", "")] = 0;
// we reserved 0, 1, 2, 3 for the empty case
string_map[MapKey("", "", "", "")] = 0;
lane_description_map[TurnLaneDescription()] = 0;
}
@@ -233,15 +233,16 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
}
};
// Deduplicates street names, destination names and refs based on the string_map map.
// In case we do not already store the name, inserts (name, id) tuple and return id.
// Deduplicates street names, refs, destinations, pronunciation based on the string_map.
// In case we do not already store the key, inserts (key, id) tuple and return id.
// Otherwise fetches the id based on the name and returns it without insertion.
const auto turn_lane_id_forward = requestId(parsed_way.turn_lanes_forward);
const auto turn_lane_id_backward = requestId(parsed_way.turn_lanes_backward);
const constexpr auto MAX_STRING_LENGTH = 255u;
// Get the unique identifier for the street name, destination, and ref
const auto name_iterator = string_map.find(MapKey(parsed_way.name, parsed_way.destinations, parsed_way.ref));
const auto name_iterator = string_map.find(
MapKey(parsed_way.name, parsed_way.destinations, parsed_way.ref, parsed_way.pronunciation));
unsigned name_id = EMPTY_NAMEID;
if (string_map.end() == name_iterator)
{
@@ -256,7 +257,8 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
name_id = external_memory.name_offsets.size() - 1;
external_memory.name_char_data.reserve(external_memory.name_char_data.size() + name_length +
destinations_length + pronunciation_length);
destinations_length + pronunciation_length +
ref_length);
std::copy(parsed_way.name.c_str(),
parsed_way.name.c_str() + name_length,
@@ -278,7 +280,8 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
std::back_inserter(external_memory.name_char_data));
external_memory.name_offsets.push_back(external_memory.name_char_data.size());
auto k = MapKey{parsed_way.name, parsed_way.destinations, parsed_way.ref};
auto k = MapKey{
parsed_way.name, parsed_way.destinations, parsed_way.ref, parsed_way.pronunciation};
auto v = MapVal{name_id};
string_map.emplace(std::move(k), std::move(v));
}
+28 -3
View File
@@ -37,9 +37,9 @@ SliproadHandler::SliproadHandler(const IntersectionGenerator &intersection_gener
// included for interface reasons only
bool SliproadHandler::canProcess(const NodeID /*nid*/,
const EdgeID /*via_eid*/,
const Intersection & /*intersection*/) const
const Intersection &intersection) const
{
return true;
return intersection.size() > 2;
}
Intersection SliproadHandler::
@@ -59,6 +59,13 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
while (intersection.size() == 2)
{
const auto node = node_based_graph.GetTarget(in_edge);
if (node == at_node)
{
// we ended up in a loop without exit
output_node = SPECIAL_NODEID;
intersection.clear();
return intersection;
}
in_edge = intersection[1].turn.eid;
output_node = node_based_graph.GetTarget(in_edge);
intersection = intersection_generator(node, in_edge);
@@ -82,6 +89,10 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
intersection_node_id, intersection[1], intersection_node_one);
const auto intersection_following_index_two = findNextIntersectionForRoad(
intersection_node_id, intersection[2], intersection_node_two);
// in case of broken roads, we return
if (intersection_following_index_one.empty() ||
intersection_following_index_two.empty())
return 0;
// In case of loops at the end of the road, we will arrive back at the intersection
// itself. If that is the case, the road is obviously not a sliproad.
@@ -128,7 +139,6 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
return intersection;
const auto source_edge_data = node_based_graph.GetEdgeData(source_edge_id);
// check whether the continue road is valid
const auto check_valid = [this, source_edge_data](const ConnectedRoad &road) {
const auto road_edge_data = node_based_graph.GetEdgeData(road.turn.eid);
@@ -181,6 +191,21 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
return intersection;
}(intersection_node_id);
const auto link_data = node_based_graph.GetEdgeData(road.turn.eid);
// Check if the road continues here
const bool is_through_street =
target_intersection.end() !=
std::find_if(target_intersection.begin() + 1,
target_intersection.end(),
[this, &link_data](const ConnectedRoad &road) {
return node_based_graph.GetEdgeData(road.turn.eid).name_id ==
link_data.name_id;
});
// if the sliproad candidate is a through street, we cannot handle it as a sliproad
if (is_through_street)
continue;
for (const auto &candidate_road : target_intersection)
{
const auto &candidate_data = node_based_graph.GetEdgeData(candidate_road.turn.eid);
+2 -1
View File
@@ -94,7 +94,8 @@ Intersection TurnAnalysis::assignTurnTypes(const NodeID from_nid,
}
}
// Handle sliproads
intersection = sliproad_handler(from_nid, via_eid, std::move(intersection));
if (sliproad_handler.canProcess(from_nid, via_eid, intersection))
intersection = sliproad_handler(from_nid, via_eid, std::move(intersection));
// Turn On Ramps Into Off Ramps, if we come from a motorway-like road
if (node_based_graph.GetEdgeData(via_eid).road_classification.IsMotorwayClass())
+8 -3
View File
@@ -63,7 +63,8 @@ inline unsigned generateServerProgramOptions(const int argc,
int &max_locations_trip,
int &max_locations_viaroute,
int &max_locations_distance_table,
int &max_locations_map_matching)
int &max_locations_map_matching,
int &max_results_nearest)
{
using boost::program_options::value;
using boost::filesystem::path;
@@ -100,7 +101,10 @@ inline unsigned generateServerProgramOptions(const int argc,
"Max. locations supported in distance table query") //
("max-matching-size",
value<int>(&max_locations_map_matching)->default_value(100),
"Max. locations supported in map matching query");
"Max. locations supported in map matching query") //
("max-nearest-size",
value<int>(&max_results_nearest)->default_value(100),
"Max. results supported in nearest 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");
@@ -189,7 +193,8 @@ int main(int argc, const char *argv[]) try
config.max_locations_trip,
config.max_locations_viaroute,
config.max_locations_distance_table,
config.max_locations_map_matching);
config.max_locations_map_matching,
config.max_results_nearest);
if (init_result == INIT_OK_DO_NOT_START_ENGINE)
{
return EXIT_SUCCESS;
+30
View File
@@ -4,6 +4,7 @@
#include "args.hpp"
#include "osrm/match_parameters.hpp"
#include "osrm/nearest_parameters.hpp"
#include "osrm/route_parameters.hpp"
#include "osrm/table_parameters.hpp"
#include "osrm/trip_parameters.hpp"
@@ -136,4 +137,33 @@ BOOST_AUTO_TEST_CASE(test_match_limits)
BOOST_CHECK(code == "TooBig"); // per the New-Server API spec
}
BOOST_AUTO_TEST_CASE(test_nearest_limits)
{
const auto args = get_args();
BOOST_REQUIRE_EQUAL(args.size(), 1);
using namespace osrm;
EngineConfig config;
config.storage_config = {args[0]};
config.use_shared_memory = false;
config.max_results_nearest = 2;
OSRM osrm{config};
NearestParameters params;
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{});
params.number_of_results = 10000;
json::Object result;
const auto rc = osrm.Nearest(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_SUITE_END()
+3
View File
@@ -42,6 +42,9 @@ BOOST_AUTO_TEST_CASE(bearing_range_test)
BOOST_CHECK_EQUAL(true, bearing::CheckInBounds(-721, 5, 10));
BOOST_CHECK_EQUAL(true, bearing::CheckInBounds(719, 5, 10));
BOOST_CHECK_EQUAL(false, bearing::CheckInBounds(1, 1, -1));
BOOST_CHECK_EQUAL(true, bearing::CheckInBounds(1, 1, 0));
}
BOOST_AUTO_TEST_SUITE_END()