Google Maps Javascript API,DirectionsService,国家/地区列表 [英] Google Maps Javascript API, DirectionsService, list of countries
问题描述
我正在使用google.maps.DirectionsService创建路线.
获取路线经过的国家列表的最佳方法是什么?
我在DirectionsResult https://developers.google.com中找不到此信息. /maps/documentation/javascript/reference#DirectionsResult
I am creating a route using google.maps.DirectionsService.
What would be the best method to get the list of countries the route goes through?
I can't find this info in the DirectionsResult https://developers.google.com/maps/documentation/javascript/reference#DirectionsResult
推荐答案
routes数组中的每个路线都有一个带有所有坐标的overview_path数组.您可以对每个坐标进行地理编码并获取其国家(请记住对地理编码调用的限制!).不是最好的解决方案,但是....
Each route from the routes array have a overview_path array with all the coordinates. You can geocode each of this coordinates and get the country of it (remember the limitation of geocoding calls!). Isn't the best solution but....
这篇关于Google Maps Javascript API,DirectionsService,国家/地区列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!