admin管理员组

文章数量:1202803

I understand that the GoogleMaps API has a limit of 25 "stops" when I submit a list of locations. I've tried submitting my list as street addresses, lat-lon waypoints, or even place ID's. I am expecting to receive back a result in JSON format that gives me my locations in the proper sequence for the most efficient driving of the route. I don't need driving directions, nor do I need the HTML to plot my route on a map. I only expect my list of locations to be returned in what the API calls "optimize=true" for the correct sequence. beginning with the "start" location and ending with the "end" location, which happens to be the same. In other words, it's a delivery route that begins and ends at a designate warehouse location.

My start and end locations are not identical because that gives an error. Instead, I've used a nearby restaurant or church that my drivers know is nearby because they know where they need to go. I'm just trying to give them a list in the most efficient route for the total driving time.

I've found that the lat-con coordinates returned by the API are not the same as those in my submitted list. They are similar, but different enough that I can't make sense of them when I press the JSON to correspond to my list.

Below is an example of the URL I have been submitting.

​?origin=39.9157936,-104.9412902&destination=39.914875208006606, -104.94368364958366&waypoints=via:39.8680412,-104.9719243| 39.9333561,-104.932516| 39.9363642,-104.9418266| 39.9383567,-104.9428774| 39.9438787,-104.9680379| 39.9477805,-104.9297139&optimize_waypoints=true&key=

At the end of the returned JSON, I see this, which suggests that my list is OK but I am unable to correlate the waypoint order to my submitted list because the lat-con coordinates are not identical to those in my list.: "warnings" : [], "waypoint_order" : [] } ], "status" : "OK" } I tried submitting my request as shown above by submitting a list of waypoints. When that failed I tried submitting addresses. When that failed I tried submitting Place ID's.

Every time I received a JSON response the lat-on coordinates did not match the GOS coordinates of my submitted list. They were geographically close, but because they did not match my list, I could not parse the JSON result to assign sequence numbers to each of the legs of the route, which is my goal. I don';t need to plot a map, I just need to get back the route in the "optimized" sequence for efficient driving.

本文标签: routesGoogleMaps API returns incorrect waypoints or place ID39sStack Overflow