我使用谷歌 Map 放置api标记附近的加油站,但我没有收到价格细节响应,因为我们在实际的谷歌 Map 中看到,我也需要距离信息 . 我怎么得到它 . ?
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=39.833851,-74.871826&radius=5000&types=gas_station&rankBy=distance&sensor=true&key=API_KEY
目前API中没有价格信息 . 我建议在这里提交功能请求:
https://b.corp.google.com/issues/new?component=188872&template=789309
至于距离信息,您需要使用方向API或距离矩阵API来获取从起点到目的地(所选加油站)的距离 . 我将使用查询中返回的第一个加油站的地点ID作为示例:
https://maps.googleapis.com/maps/api/directions/json?origin=39.833851,-74.871826&destination=place_id:ChIJc44A2jYxwYkR9_42tATl9n0&key=MY_API_KEY
我希望这有帮助!
1 回答
目前API中没有价格信息 . 我建议在这里提交功能请求:
https://b.corp.google.com/issues/new?component=188872&template=789309
至于距离信息,您需要使用方向API或距离矩阵API来获取从起点到目的地(所选加油站)的距离 . 我将使用查询中返回的第一个加油站的地点ID作为示例:
https://maps.googleapis.com/maps/api/directions/json?origin=39.833851,-74.871826&destination=place_id:ChIJc44A2jYxwYkR9_42tATl9n0&key=MY_API_KEY
我希望这有帮助!