add osrm-routed and node-osrm flags to configure mapmatching radius limit (#4721)

This commit is contained in:
Kajari Ghosh
2017-12-20 16:53:43 +05:30
committed by GitHub
parent 5af776d963
commit 84b6ef4340
11 changed files with 90 additions and 16 deletions
+33 -1
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_limits)
BOOST_AUTO_TEST_CASE(test_match_coordinate_limits)
{
using namespace osrm;
@@ -131,6 +131,38 @@ BOOST_AUTO_TEST_CASE(test_match_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;
+16 -2
View File
@@ -74,8 +74,6 @@ 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)
@@ -559,6 +557,22 @@ 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}}};