对 google 的 http 请求将 api 方向映射到 waypoints
A http request to google maps api direction with waypoints
我正在开发一个 android 应用程序,使用方向 google 地图 api v2。据说 here 我可以在我的 http 请求中放置最多“8 waypoints”(我假设加上起点和终点)。所以,我的代码生成了下面的请求(我订购了它,所以你可以计算 waypoints 的数量)。
https://maps.googleapis.com/maps/api/directions/json?origin=45.509166,-73.497897&destination=5.5027,-73.503455&waypoints=optimize:true|
45.509196,-73.495494|
45.511166,-73.493584|
45.515887,-73.500751|
45.516835,-73.507189|
45.51497,-73.514892|
45.507828,-73.515879|
45.504038,-73.516008|
45.508971,-73.505665|
&sensor=false&API_KEY
这是我得到的答案:
{
"routes" : [],
"status" : "ZERO_RESULTS"
}
谁能帮我理解哪里出了问题?我的请求是否有错误,或者我绕过了方向 google 映射 api?
的限制
固然是个猜测,去掉waypoints的优化?优化不会改变你设置的地方吗?
我知道您可以使用方向响应元素向您抛出一些状态代码以帮助调试。 "NOT_FOUND indicates at least one of the locations specified in the request's origin, destination, or waypoints could not be geocoded."
可能您的 url 遗漏了一些新的 url
我正在开发一个 android 应用程序,使用方向 google 地图 api v2。据说 here 我可以在我的 http 请求中放置最多“8 waypoints”(我假设加上起点和终点)。所以,我的代码生成了下面的请求(我订购了它,所以你可以计算 waypoints 的数量)。
https://maps.googleapis.com/maps/api/directions/json?origin=45.509166,-73.497897&destination=5.5027,-73.503455&waypoints=optimize:true| 45.509196,-73.495494| 45.511166,-73.493584| 45.515887,-73.500751| 45.516835,-73.507189| 45.51497,-73.514892| 45.507828,-73.515879| 45.504038,-73.516008| 45.508971,-73.505665| &sensor=false&API_KEY
这是我得到的答案:
{
"routes" : [],
"status" : "ZERO_RESULTS"
}
谁能帮我理解哪里出了问题?我的请求是否有错误,或者我绕过了方向 google 映射 api?
的限制固然是个猜测,去掉waypoints的优化?优化不会改变你设置的地方吗?
我知道您可以使用方向响应元素向您抛出一些状态代码以帮助调试。 "NOT_FOUND indicates at least one of the locations specified in the request's origin, destination, or waypoints could not be geocoded."