【问题标题】:Highlighting a street on google map in android在android中突出显示谷歌地图上的街道
【发布时间】:2014-07-17 06:35:12
【问题描述】:

android 是否可以在用户点击 google map 时突出显示街道 街道?目前我正在研究一个app,它可以识别有停车场的街道 插槽可用。

【问题讨论】:

    标签: android google-maps


    【解决方案1】:

    这个小提琴可以帮助:

    // 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);
      }
    });
    

    http://jsfiddle.net/HG7SV/15/

    其他选项:

    https://developers.google.com/maps/documentation/javascript/directions

    【讨论】:

      猜你喜欢
      • 2011-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-03
      • 1970-01-01
      • 2015-04-21
      相关资源
      最近更新 更多