已知两点的坐标,我要怎样返回两点间的交通线路?

1 view
Skip to first unread message

miya tang

unread,
Jan 21, 2010, 10:21:03 PM1/21/10
to Google-Map...@googlegroups.com
   <script type="text/javascript"> 
// 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"));
map.setCenter(new GLatLng(42.351505,-71.094455), 15);
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);
directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)", {travelMode:G_TRAVEL_MODE_WALKING});
}
</script>

以上是GOOGLE 交通线路的示例代码,看到
directions.load 里面,只能传入两个地址名称.但我已知道出发点,和目的地的坐标点.就应该是传入坐标就可以吧.
要怎样来实现?

请各位高手指点.




Reply all
Reply to author
Forward
0 new messages