2011-02-03 99 views

回答

1

的OpenLayers不換谷歌地圖的路線功能。您仍然可以在OpenLayers中使用Google地圖圖層,並使用Google的API向Directions Services發送請求。

如果您要求如例如在他們的文檔頁面:

directionsService.route(request, function(result, status) { 
if (status == google.maps.DirectionsStatus.OK) { 
    directionsDisplay.setDirections(result); 
} 

});

您會注意到result.routes.overview_path包含路線的所有點。然後,您可以使用OpenLayers.Layers.Vector在Google地圖圖層上方的單獨圖層中呈現此路線。