zoukankan      html  css  js  c++  java
  • 腾讯地图 获取各种情况的总距离

    引用腾讯地图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;

  • 相关阅读:
    ssd的BUG
    ImportError: No module named lmdb
    GPU卡掉卡
    mobileeye
    caffe convert mxnet
    学前书单-百科
    捉襟见肘
    caffe+opencv3.3.1
    ipython notebook开通远程
    到底什么是故事点(Story Point)?
  • 原文地址:https://www.cnblogs.com/Liq-Blog/p/3773846.html
Copyright © 2011-2022 走看看