问题描述
谷歌举了个例子http://googlemapsapi.blogspot.com/2007/05/driving-directions-support- added-to.html
是否可以在某处找到源代码或有关该精确示例的教程?
这是一个使用 v3 API:
<头><meta http-equiv="content-type" content="text/html; charset=UTF-8"/><title>Google Maps API v3 路线示例</title><脚本类型=文本/javascript"src="http://maps.google.com/maps/api/js?sensor=false"></script>头部><body style="font-family: Arial; font-size: 12px;"><div style="width: 600px;"><div id="map" style="width: 280px; height: 400px; float: left;"></div><div id="panel" style="width: 300px; float: right;"></div>
<script type="text/javascript">var directionService = new google.maps.DirectionsService();var directionDisplay = new google.maps.DirectionsRenderer();var map = new google.maps.Map(document.getElementById('map'), {变焦:7,mapTypeId: google.maps.MapTypeId.ROADMAP});DirectionsDisplay.setMap(地图);DirectionsDisplay.setPanel(document.getElementById('panel'));无功请求 = {产地:'芝加哥',目的地:纽约",旅行模式:google.maps.DirectionsTravelMode.DRIVING};路线Service.route(请求,功能(响应,状态){如果(状态 == google.maps.DirectionsStatus.OK){DirectionsDisplay.setDirections(响应);}});