// 测距算法
function distance(pointX, pointY) {
// 获取定位坐标data.position
// 定位坐标
var localL = [];
var localL = localStorage.getItem("local");
if (localL == null) {
localL = "108.173169,26.494508"
}
var localL = localL.split(',')
var localLng = localL[0];
var localLat = localL[1];
var pLocal = [localLng, localLat];
var pPoint = [pointX, pointY];
// 返回 p1 到 p2 间的地面距离,单位:米
var dis = AMap.GeometryUtil.distance(pLocal, pPoint);
var dis = Math.round(dis)
return dis;
}