我是新来的API,我有这个来创建我的地图,但我想采取行驶方向,我应该改变什么来实现这个目的。我有很多来自MySQL的标记,所以我不需要重新开始,只是删除方向。如何从Google Map API v3地图中删除路线?
Here是网页。
这是代码为渲染地图:
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer();
var myOptions = {
zoom:7,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsDisplay.setMap(map);
var request = {
origin: '<?php echo $orgcitname; ?>',
destination: '<?php echo $descitname; ?>',
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
谢谢你做到了......但我也错过了我的中心是为什么地图根本不会显示 –