【发布时间】:2017-07-22 13:58:12
【问题描述】:
【问题讨论】:
-
添加标记的当前代码是什么
-
@geocodezip,在您的示例中,如果我拖动标记,航点图标的位置不正确。
标签: javascript html google-maps-api-3 google-geocoder
【问题讨论】:
标签: javascript html google-maps-api-3 google-geocoder
你可以用这个删除标记:
directionsDisplay.setOptions( { suppressMarkers: true } );
因为你有方向参数“destination”你知道你要去哪里,所以你可以自己添加另一个:
var latlngDestination = new google.maps.LatLng(???,???) ;
var markerDestination = new google.maps.Marker({
map: map,
position: latlngDestination,
draggable: true,
icon: 'http://www.google.com/mapfiles/markerA.png'
});
directionsService.route({
origin: ???,
destination: latlngDestination ,
travelMode: 'DRIVING'
}
对于捕捉部分,您在这里有相同的问题和解决方案:Snap to nearest street
【讨论】: