Reputation: 373
I have a list of 26 coordinates, coordinates might increase in future. I am basically trying to draw a route/polyline around Australia. I want to draw the whole route/polyline in a single route builder call. There are 2 limitations right now.
val routeBuilder = NavigationRoute.builder(mContext).accessToken(MapBoxUtils.MAP_KEY).origin(startPoint!!).destination(it)
.profile(DirectionsCriteria.PROFILE_CYCLING)
val endIndex = checkPointList.size - 1
for ((index, point) in checkPointList.withIndex()) {
if (index != 0 && index < endIndex) {
routeBuilder.addWaypoint(Point.fromLngLat(point.coordinates.longitude.toDouble(), point.coordinates.latitude.toDouble()))
}
}
routeBuilder.build().getRoute(object:Callback<DirectionsResponse> {
override fun onFailure(call: Call<DirectionsResponse>, t: Throwable) {
Timber.e("Error: " + t.message)
}
override fun onResponse(call: Call<DirectionsResponse>, response: Response<DirectionsResponse>) {
if (response.body() == null) {
showToast(getErrorMessage(response.errorBody()!!.string()))
return
} else if (response.body()!!.routes().size < 1) {
showToast("No routes found")
return
} else{
//draw route here
}
})
as mentioned here https://docs.mapbox.com/api/navigation/
I have already contacted technical support and they are not responding to my requests. Let me know if there is any workaround or I will have to make two calls to achieve this.
Upvotes: 3
Views: 1935
Reputation: 373
I have finally received a response from MapBox technical support.
Thank you for using Mapbox! As noted in our documentation for Directions API restrictions and limits, there is a limit of 300 requests per minute, with up to 25 waypoints along each route. The limit of 10,000 kilometers between all waypoints cannot be changed. However, you could consider making multiple requests to the Directions API and then concatenating the results together. For example, "Port Hedland" could be the last destination passed to one API request, and also the first destination passed to the next API request. Concatenating the resulting routes would generate a continuous line.
Upvotes: 3