Google Maps API行车路线 [英] Google Maps API Driving Directions

查看:84
本文介绍了Google Maps API行车路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以找到一个API调用来给我提供行车路线,并在它们之间画线。

我使用Google地图API,并且有20分的地图。 ?

解决方案

是的,可以做到。 Google Maps API文档非常准确地描述了如何做到这一点:

您可以使用 GDirections 添加计算方向的功能(使用各种运输方式)对象 GDirections 对象使用任一查询字符串(例如New York,NY to Chicago,IL)或文本经纬度来请求和接收方向结果。


$ b

GDirections 对象还支持使用一系列路标的多部分路线。路线可能显示为在地图上绘制路线的多段线,作为< div> 元素中的一系列文字说明(例如,向右转威廉斯堡桥斜坡)或两者兼而有之。



不幸的是,所有国家尚未提供驾驶路线指引。您可能需要查看以下电子表格,以查看特定位置是否有行车路线指示:

Google代码 - 已过滤的地图覆盖范围

I use Google Maps API and I have a map with 20 points on it.

Can I find an API call to give me driving directions and draw lines between them?

解决方案

Yes, it can be done. The Google Maps API Documentation describes how to this very accurately:

"You can add the ability to calculate directions (using a variety of methods of transportation) by using the GDirections object. The GDirections object requests and receives direction results using either query strings (e.g. "New York, NY to Chicago, IL") or textual lat/lons.

The GDirections object also supports multi-part directions using a series of waypoints. Directions may be displayed as either a polyline drawing the route on a map, as a series of textual description within a <div> element (e.g. "Turn right onto the Williamsburg Bridge ramp") or both."

Unfortunately driving directions are not yet available for all countries. You may want to check the following spreadsheet to see if driving directions are available for a particular location:

Google Code - Map Coverage Filtered

这篇关于Google Maps API行车路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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