Google map direction services waypoints more than 50

后端 未结 5 1026
名媛妹妹
名媛妹妹 2020-12-13 16:36

Documentation says that waypoints limit is 8 points. But I have to find best waypoints order list from more than 50 waypoints. How to do that?

I am able to find wayp

5条回答
  •  情深已故
    2020-12-13 17:02

    I've created a workaround but it is a bit more expensive (in terms of API calls) to use.

    Instead of creating a single call with the start, end, and waypoints LatLngs, I split the waypoints into pairs make the calls per pair.

    Example:

    Problem: Route and get Directions for 100 points

    Solution:

    • Call 1: Point 1 and Point 2
    • Call 2: Point 2 and Point 3
    • Call 3: Point 3 and Point 4

      ... and so on.

    With this solution you'll never have to worry about the 8 waypoint limitation since you're only making a 2 point query every time. The weakness of this solution is you will be creating a lot of calls and it will eat up your 2500 free calls per day if not used properly.

提交回复
热议问题