request polyline with precision of 5 or 6 positions (#3220)
This commit is contained in:
@@ -42,9 +42,9 @@ std::string modeToString(const extractor::TravelMode mode);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename ForwardIter> util::json::String makePolyline(ForwardIter begin, ForwardIter end)
|
||||
template <unsigned POLYLINE_PRECISION, typename ForwardIter> util::json::String makePolyline(ForwardIter begin, ForwardIter end)
|
||||
{
|
||||
return {encodePolyline(begin, end)};
|
||||
return {encodePolyline<POLYLINE_PRECISION>(begin, end)};
|
||||
}
|
||||
|
||||
template <typename ForwardIter>
|
||||
|
||||
@@ -68,7 +68,12 @@ class RouteAPI : public BaseAPI
|
||||
{
|
||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
||||
{
|
||||
return json::makePolyline(begin, end);
|
||||
return json::makePolyline<100000>(begin, end);
|
||||
}
|
||||
|
||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
||||
{
|
||||
return json::makePolyline<1000000>(begin, end);
|
||||
}
|
||||
|
||||
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
|
||||
@@ -192,9 +197,17 @@ class RouteAPI : public BaseAPI
|
||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline)
|
||||
{
|
||||
return static_cast<util::json::Value>(
|
||||
json::makePolyline(leg_geometry.locations.begin() + step.geometry_begin,
|
||||
json::makePolyline<100000>(leg_geometry.locations.begin() + step.geometry_begin,
|
||||
leg_geometry.locations.begin() + step.geometry_end));
|
||||
}
|
||||
|
||||
if (parameters.geometries == RouteParameters::GeometriesType::Polyline6)
|
||||
{
|
||||
return static_cast<util::json::Value>(
|
||||
json::makePolyline<1000000>(leg_geometry.locations.begin() + step.geometry_begin,
|
||||
leg_geometry.locations.begin() + step.geometry_end));
|
||||
}
|
||||
|
||||
BOOST_ASSERT(parameters.geometries == RouteParameters::GeometriesType::GeoJSON);
|
||||
return static_cast<util::json::Value>(json::makeGeoJSONGeometry(
|
||||
leg_geometry.locations.begin() + step.geometry_begin,
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace api
|
||||
* Holds member attributes:
|
||||
* - steps: return route step for each route leg
|
||||
* - alternatives: tries to find alternative routes
|
||||
* - geometries: route geometry encoded in Polyline or GeoJSON
|
||||
* - geometries: route geometry encoded in Polyline, Polyline6 or GeoJSON
|
||||
* - overview: adds overview geometry either Full, Simplified (according to highest zoom level) or
|
||||
* False (not at all)
|
||||
* - continue_straight: enable or disable continue_straight (disabled by default)
|
||||
@@ -58,6 +58,7 @@ struct RouteParameters : public BaseParameters
|
||||
enum class GeometriesType
|
||||
{
|
||||
Polyline,
|
||||
Polyline6,
|
||||
GeoJSON
|
||||
};
|
||||
enum class OverviewType
|
||||
|
||||
Reference in New Issue
Block a user