使用Google Directions API绘制包含8个以上航路点的路线图

无效化

我正在尝试绘制具有多个航点的路线图。根据Google API,您只能使用8个航点,而对于业务发展,您只能使用23个航点,但这不足以绘制准确的旅行地图。

我在这里得到了一个值得注意的解决方案链接,但工作不正常。

该解决方案在某个点上存在一个问题,它将无法绘制路线图。

如果打开我的JSFiddle,您会发现有很多方法要点:

喜欢:-

点数= [[28.595161666666666,77.31429666666666],[28.602561666666663、77.31256166666667],[28.594639999999995、77.30559166666667],[28.585825、77.30017],[28.58475333333333、77.30100333333333],[28.583.77。 ],[28.584080000000004、77.30304],[28.583235、77.303585000000000000],[28.584435、77.30268333333333],[28.583306666666665、77.30265666666666],[28.584278333333334、77.30283833333333],[28.586365、77.29805166666667。 [28.584238333333328、77.30340666666666],[28.584101666666665、77.30290666666666],[28.590111666666665、77.30175666666668],[28.584323333333334、77.30297333333333],[28.584215000000004、77.30304666666666],387.28.583.333333[28.583798333333334、77.30157833333332],[28.584288333333333、77.30296166666668],[28.583810000000003、77.30295333333333],[28.583908333333337、77.3020116666666767],[28.58464333333333、77.30217833333333] 666 ,77.28125833333334]]

这些数据集(“点”)返回错误,为status=ZERO_RESULTS

现在,如果您[28.575966666666666, 77.28125833333334]从点数组中删除最后一个点(),则此点将正常工作,状态为OK

为什么我得到ZERO_RESULTS代替OK我该如何跳过那些有问题的要点?

这是我的JSFiddle:-http: //jsfiddle.net/67tbw/28/

无效化

最终修复了它,现在它可以在任何数量的点上使用,现在status = ZERO_RESULTS将不再是问题。

问题是我得到了某些点status=ZERO_RESULT。之后它停止执行并且由于我没有得到地图。所以要解决这个问题,我提出了一种解决方案,即在状态不等于时跳过特定点OK。然后继续剩下的重点。为此,我采用了两个参数,一个是用于存储最后一个索引,另一个是路径。因为当我无法获得OK状态时,我将无法从状态中获取lastIndx和路径,因此,当我遇到问题时,它将进入其他部分,而我确实这样做了。

1. lastIndx = lastIndx+1 ,
2. gDirRequest(service, waypoints, userFunction,lastIndx , path) 

*再次调用该函数,直到最后一点。在两次间,如果我的状态为OK,则将路径存储为当前路径,将lastIndx存储为当前索引(lastIndx = s [1])。

检查此JSFiddle:-http: //jsfiddle.net/kousik/2pNKH/

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用Google Directions API绘制包含8个以上航路点的路线图

来自分类Dev

Google Directions API错误

来自分类Dev

Google Directions API限制

来自分类Dev

Google Directions API限制

来自分类Dev

Google Maps Directions API

来自分类Dev

Google Directions API编码折线

来自分类Dev

使用Google Directions API转换模式摆脱车站标记

来自分类Dev

如何从Google Directions API中返回距离以供以后使用?

来自分类Dev

如何使用库在Android中实现Google Directions API?

来自分类Dev

Google Map Distance and Directions API之间的区别

来自分类Dev

Google Directions API的替代品

来自分类Dev

在Google Directions api中提供路径的颜色

来自分类Dev

Google Directions API-多条腿

来自分类Dev

Google Directions Matrix API出现问题

来自分类Dev

Android版Google Directions API中的更改路线选项

来自分类Dev

在Android中使用Directions API显示多条路线

来自分类Dev

在Android中使用Directions API显示多条路线

来自分类Dev

Google Directions API无法在iOS中返回结果

来自分类Dev

要求Google Directions api错误请求传感器

来自分类Dev

调用Google Directions API表单Xamarin.Forms应用

来自分类Dev

从R呼叫时,来自Google Directions API的格式错误的JSON

来自分类Dev

如何在Google Maps Directions API响应上查找坐标?

来自分类Dev

Google Directions API可以在Android上逐个转弯吗?

来自分类Dev

iOS Today Extension对Google Directions API的POST请求

来自分类Dev

Google Directions API的start_address与输入中的来源不同

来自分类Dev

Google Maps Directions API 如何区分联运换乘?

来自分类Dev

使用Google Map API时如何知道何时退出环形交叉路口-Directions API

来自分类Dev

使用 Google Directions API 获取 API 在 reactjs 中不起作用

来自分类Dev

使用Google Maps API绘制地图路径/航路点并播放路线

Related 相关文章

  1. 1

    使用Google Directions API绘制包含8个以上航路点的路线图

  2. 2

    Google Directions API错误

  3. 3

    Google Directions API限制

  4. 4

    Google Directions API限制

  5. 5

    Google Maps Directions API

  6. 6

    Google Directions API编码折线

  7. 7

    使用Google Directions API转换模式摆脱车站标记

  8. 8

    如何从Google Directions API中返回距离以供以后使用?

  9. 9

    如何使用库在Android中实现Google Directions API?

  10. 10

    Google Map Distance and Directions API之间的区别

  11. 11

    Google Directions API的替代品

  12. 12

    在Google Directions api中提供路径的颜色

  13. 13

    Google Directions API-多条腿

  14. 14

    Google Directions Matrix API出现问题

  15. 15

    Android版Google Directions API中的更改路线选项

  16. 16

    在Android中使用Directions API显示多条路线

  17. 17

    在Android中使用Directions API显示多条路线

  18. 18

    Google Directions API无法在iOS中返回结果

  19. 19

    要求Google Directions api错误请求传感器

  20. 20

    调用Google Directions API表单Xamarin.Forms应用

  21. 21

    从R呼叫时,来自Google Directions API的格式错误的JSON

  22. 22

    如何在Google Maps Directions API响应上查找坐标?

  23. 23

    Google Directions API可以在Android上逐个转弯吗?

  24. 24

    iOS Today Extension对Google Directions API的POST请求

  25. 25

    Google Directions API的start_address与输入中的来源不同

  26. 26

    Google Maps Directions API 如何区分联运换乘?

  27. 27

    使用Google Map API时如何知道何时退出环形交叉路口-Directions API

  28. 28

    使用 Google Directions API 获取 API 在 reactjs 中不起作用

  29. 29

    使用Google Maps API绘制地图路径/航路点并播放路线

热门标签

归档