最近在研究Google地图相关的东西,在这里做点备忘。
1、可以使用GMaps.js这个库来简化一些操作,地址:[url]https://github.com/HPNeo/gmaps[/url]
2、使用drawRoute和drawSteppedRoute方法时,需要注意以下几点:
1)waypoints这个参数一个指定途径点的数组,免费版API最多支持8个点,商业版支持23个点([url=https://developers.google.com/maps/documentation/javascript/directions?hl=zh-cn#Waypoints]详情[/url])
2)每一个waypoints都是符合google.maps.DirectionsWaypoint格式的一个对象,它的stopover属性默认是true,请显式的把每一个都设置为false,否则路线遇到stopover为true的就不绘制了([url=https://developers.google.com/maps/documentation/javascript/reference#DirectionsWaypoint]详情[/url])
3)需要传递一个step callback,从GMaps.js的源码中看,只有传递了这个参数,它才会去绘制路线。(仅drawSteppedRoute)
1、可以使用GMaps.js这个库来简化一些操作,地址:[url]https://github.com/HPNeo/gmaps[/url]
2、使用drawRoute和drawSteppedRoute方法时,需要注意以下几点:
1)waypoints这个参数一个指定途径点的数组,免费版API最多支持8个点,商业版支持23个点([url=https://developers.google.com/maps/documentation/javascript/directions?hl=zh-cn#Waypoints]详情[/url])
2)每一个waypoints都是符合google.maps.DirectionsWaypoint格式的一个对象,它的stopover属性默认是true,请显式的把每一个都设置为false,否则路线遇到stopover为true的就不绘制了([url=https://developers.google.com/maps/documentation/javascript/reference#DirectionsWaypoint]详情[/url])
3)需要传递一个step callback,从GMaps.js的源码中看,只有传递了这个参数,它才会去绘制路线。(仅drawSteppedRoute)