1,打卡签到 —— 500米范围限制
    a,getLocation 获取gcj02 == 腾讯系坐标,可以直接用来打开腾讯地图 (获取wgs84则需转换)
    b,百度坐标转腾讯坐标,引入链接配置
<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp&libraries=convertor"></script><!-- 百度坐标转化为腾讯系坐标 -->
        qq.maps.convertor.translate(new qq.maps.LatLng(vm.list.activityPlacePoilat,vm.list.activityPlacePoilng), 3, function(res){
            var latlng = res[0];
           var latitudeFromPC = latlng.lat;
           var longitudeFromPC = latlng.lng;
        })
具体参数内容,详情:https://lbs.qq.com/javascript_v2/doc/convertor.html ;
c,转换原理的理解
WGS-84:是国际标准,GPS坐标(Google Earth使用、或者GPS模块)(GPS全球卫星定位系统使用的坐标系)
GCJ-02:中国坐标偏移标准,Google Map、高德、腾讯使用(由WGS84坐标系经加密后的坐标系)
BD-09:百度坐标偏移标准,Baidu Map使用(在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标)
d,500米经纬度差 大约 500÷1000÷40000×360=0.0045度 复验百度坐标地图观察
2、腾讯地图api——逆解析
a) 获取guj02坐标系 b) 申请key,请求转换 如下:
  var data={
	          location : locationGCJ02.latitude + ‘,‘ + locationGCJ02.longitude,
             /*换成自己申请的key*/
	          key:"6EBBZ-S5SW6-FZ5SV-MBBXH-5TZPE-X4BN7",
	          get_poi:0    
	      };
	      var url="https://apis.map.qq.com/ws/geocoder/v1/?";
	      data.output="jsonp";  
	      $.ajax({
	            type:"get",
	            dataType:‘jsonp‘,
	            data:data,
	            jsonp:"callback",
	            jsonpCallback:"QQmap",
	            url:url,
	            success:function(res){
	        	      if(res.status==0){
		                    var toStr = JSON.stringify(res);
		                    alert(toStr);
	        	      }
	            },
	            error : function(err){alert("服务端错误,请刷新浏览器后重试")}
});
参考:https://www.cnblogs.com/benefitworld/p/5328420.html
https://lbs.qq.com/webservice_v1/guide-gcoder.html
3,腾讯地图api——计算两个坐标系,非直线距离
distanceMap:function(){
    		    var that=this ,
    		        data={
    				       from : that.urgDate.locationForm.lat+‘,‘+that.urgDate.locationForm.lng ,
  		          to : getLocationStr.locationGCJ02.latitude + ‘,‘ +	getLocationStr.locationGCJ02.longitude,
  		          key: window.common.mapKey.qqMapKey ,
      		        } , 
      		        url="https://apis.map.qq.com/ws/distance/v1/?";
    		
      		        data.output="jsonp";  
      		        $.ajax({
      url:url,
      		              type:"get",
      		              dataType:‘jsonp‘,
      		              data:data,
      		              jsonp:"callback",
      		              jsonpCallback:"QQmap",
      		              success:function(res){
      		        	      if(res.status==0){
      		        		        try{
      		        			          var toStr = JSON.stringify(res);
           			                      //alert(toStr);
           			                      that.urgDate.myDistance = res.result.elements[0].distance;
      		        		        }catch(e){
      		        			          console.log("坐标系距离计算错误");
      		        		        }
      		        	      }
      		            },
      		            error : function(err){console.log("坐标系距离计算网络链接失败");}
      		        });
    	  },
参考:https://lbs.qq.com/webservice_v1/guide-distance.html
4,坐标间直线距离,计算公式:
  distanceMap:function(lat1, lng1, lat2, lng2){
    		    function toRad(d) {  return d * Math.PI / 180; }
    		    var dis = 0;
		        var radLat1 = toRad(lat1);
		        var radLat2 = toRad(lat2);
		        var deltaLat = radLat1 - radLat2;
		        var deltaLng = toRad(lng1) - toRad(lng2);
		        var dis = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(deltaLat / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(deltaLng / 2), 2)));
		        return  dis * 6378137;
              }
原文:https://www.cnblogs.com/fireflying/p/9854620.html