var map = new BMap.Map("container"); var point1 = new BMap.Point(lng1,lat1); var point2 = new BMap.Point(lng2,lat2); var distance = map.getDistance(point1,point2);