问题描述
在用户点击$ b $时,是否有可能在 android
中突出显示 google map
b街道?目前,我正在处理一个 app
,它可以识别停车位
可用的街道。
//初始化映射
var myOptions = {
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById(map_canvas),myOptions);
//初始方向服务
var dirService = new google.maps.DirectionsService();
var dirRenderer = new google.maps.DirectionsRenderer({suppressMarkers:true});
dirRenderer.setMap(map);
//突出显示街道
var request = {
origin:48.1252,11.5407,
destination:48.13376,11.5535,
/ / waypoints:[{location:48.12449,11.5536},{location:48.12515,11.5569}],
travelMode:google.maps.TravelMode.DRIVING
};
dirService.route(request,function(result,status){
if(status == google.maps.DirectionsStatus.OK){
dirRenderer.setDirections(result);
}
});
其他选项:
Is it possible in android
to highlight a street on google map
as the user taps on thestreet? Currently I am working on an app
which would identify the streets where a parkingslot is available.
This fiddle could help:
// init map
var myOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
// init directions service
var dirService = new google.maps.DirectionsService();
var dirRenderer = new google.maps.DirectionsRenderer({suppressMarkers: true});
dirRenderer.setMap(map);
// highlight a street
var request = {
origin: "48.1252,11.5407",
destination: "48.13376,11.5535",
//waypoints: [{location:"48.12449,11.5536"}, {location:"48.12515,11.5569"}],
travelMode: google.maps.TravelMode.DRIVING
};
dirService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
dirRenderer.setDirections(result);
}
});
Additional options:
https://developers.google.com/maps/documentation/javascript/directions
这篇关于在android中突出显示谷歌地图上的街道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!