Google Maps Javascript API,DirectionsService,国家/地区列表 [英] Google Maps Javascript API, DirectionsService, list of countries

查看:113
本文介绍了Google Maps Javascript API,DirectionsService,国家/地区列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆