• 腾讯地图 获取各种情况的总距离


    引用腾讯地图js:<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp&libraries=geometry"></script>

    线路距离:

    var map,

      directionsService = new qq.maps.DrivingService({           

      complete: function (response) {              

      var start = response.detail.start,                  

      end = response.detail.end;             

      directions_routes = response.detail.routes;     

      var distance = directions_routes[0].distance;//总距离      

           }       

      }),directions_routes;

      function sosoDistance(start_lat, start_lng, end_lat, end_lng) {        

      //LEAST_TIME   最少时间        

      //LEAST_DISTANCE   最短距离        

      //AVOID_HIGHWAYS     避开高速        

      //REAL_TRAFFIC     实时路况        

      //PREDICT_TRAFFIC     预测路况        

      directionsService.setPolicy(qq.maps.DrivingPolicy["LEAST_DISTANCE"]);        

      directionsService.search(new qq.maps.LatLng(start_lat, start_lng),

      new qq.maps.LatLng(end_lat, end_lng));    

      }

    ----------------------------我是漂亮的分割线-------------------------------------------------

    直线距离:

    var start = new qq.maps.LatLng(start_lat, start_lng), end = new qq.maps.LatLng(end_lat, end_lng);

                var total = Math.round(qq.maps.geometry.spherical.computeDistanceBetween(start, end) * 10) / 10;

  • 相关阅读:
    题目
    先贤祠3
    先贤祠2
    先贤祠1
    论文他引次数及ESI高被引论文查询方法
    [唐诗]古风(其三十一)-李白
    [唐诗]古风(其二十四)-李白
    [唐诗]古风(其十九)-李白
    [唐诗]古风(其十五)-李白
    [唐诗]古风(其三)-李白
  • 原文地址:https://www.cnblogs.com/Liq-Blog/p/3773846.html
Copyright © 2020-2023  润新知