Javascript 谷歌地图API V3:显示方向时忽略缩放
我已经创建了一张地图,在那里我需要显示从a点到B点的道路。到目前为止还不错。我有两个问题:第一个问题是,中心缩放级别选项被忽略,显示点B的标记出现两次Javascript 谷歌地图API V3:显示方向时忽略缩放,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,我已经创建了一张地图,在那里我需要显示从a点到B点的道路。到目前为止还不错。我有两个问题:第一个问题是,中心缩放级别选项被忽略,显示点B的标记出现两次 <div id="map-canvas"></div> 请参见此处的运行脚本说明 “居中缩放”选项将被忽略,因为您正在两点之间使用方向服务。这将覆盖地图中心和缩放。为了保存这种用途 显示点B的标记出现两次,这是由于您使用的方向服务(travelMode DRIVING),它将指向最合适的位置。我认为最好删除pointA和
<div id="map-canvas"></div>
请参见此处的运行脚本说明
directionsService = new google.maps.DirectionsService,
directionsDisplay = new google.maps.DirectionsRenderer({
map: map,
preserveViewport: true //Added to preserve viewport
}),
directionsService = new google.maps.DirectionsService,
directionsDisplay = new google.maps.DirectionsRenderer({
map: map,
preserveViewport: true //Added to preserve viewport
}),