获得免费驾驶指示的最佳方式

时间:2009-03-23 11:13:29

标签: java maps driving-directions

是否有简单的方法来获取驾驶指示?

类似于:我调用“http://someservice/?start=NYC&target=Washington”,然后服务返回包含路由信息的XML文件?

有没有人试图从独立的桌面应用程序访问这样的基于Web的服务?

真的很感激任何帮助!

更新:感谢提示,但遗憾的是我无法运行JavaScript。是否还有可能收到驾驶指示?

3 个答案:

答案 0 :(得分:6)

答案 1 :(得分:3)

Google maps API

来自Directions doc

的示例
// Create a directions object and register a map and DIV to hold the 
// resulting computed directions

var map;
var directionsPanel;
var directions;

function initialize() {
  map = new GMap2(document.getElementById("map_canvas"));
  directionsPanel = document.getElementById("my_textual_div");
  map.setCenter(new GLatLng(49.496675,-102.65625), 3);
  directions = new GDirections(map, directionsPanel);
  directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)");
}

答案 2 :(得分:0)

根据您的应用程序,它可能还不是一个可行的选项,但您可能希望使用OpenStreetMap数据查看各种路由产品。 routing wiki page提供了有关各种项目的更多信息。