你需要使用Google Directions Web Service。你可以发出HTTP请求,将你的两个位置作为参数传递,并获得JSON(或XML)格式的描述两点之间路线的数据。 注意:Google 地图服务条款明确规定,禁止在不将结果放在 Google 地图上的情况下使用 Google 地图网络服务。
使用Directions API: http://code.google.com/apis/maps/documentation/directions/ 默认的旅行模式是驾车。请阅读服务条款: http://code.google.com/apis/maps/terms.html 特别是第10.12节,它涉及使用此API的结果。简而言之,您必须与Google地图一起显示它。