【问题标题】:Draw a route/polyline using MapBox with more than 25 waypoints/coordinates使用超过 25 个航点/坐标的 MapBox 绘制路线/折线
【发布时间】:2019-11-20 12:37:07
【问题描述】:

我有一个包含 26 个坐标的列表,未来坐标可能会增加。我基本上是想在澳大利亚周围画一条路线/折线。我想在单个路线构建器调用中绘制整个路线/折线。目前有 2 个限制。

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
                }

            })
  1. 在请求中添加的坐标不能超过 25 个。
  2. 所有航路点之间的最大总距离不能超过 10,000 公里。就我而言,它是 12,000 公里。

这里提到https://docs.mapbox.com/api/navigation/

我已经联系了技术支持,但他们没有回应我的请求。让我知道是否有任何解决方法,否则我将不得不拨打两个电话才能实现这一目标。

【问题讨论】:

  • 投反对票的人应该添加投反对票的理由!

标签: android mapbox mapbox-android


【解决方案1】:

我终于收到了 MapBox 技术支持的回复。

感谢您使用 Mapbox!如我们的文档中所述 路线API限制和限制,有300个限制 每分钟请求数,每条路线最多有 25 个航路点。这 所有航路点之间 10,000 公里的限制不能更改。 但是,您可以考虑向路线提出多个请求 API,然后将结果连接在一起。例如,“端口 Hedland”可能是传递给一个 API 请求的最后一个目的地,并且 也是传递给下一个 API 请求的第一个目的地。 连接生成的路由将生成一条连续的线。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-20
    • 1970-01-01
    • 2018-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多