html>
两点间距离html,body,#container{
height:100%;
}
//初始化地图对象,加载地图
var map = new AMap.Map("container", {
resizeEnable: true,
zoom: 13
});
var m1 = new AMap.Marker({
map: map,
position: new AMap.LngLat(116.368904, 39.923423)
});
var m2 = new AMap.Marker({
map: map,
position:new AMap.LngLat(116.387271, 39.922501)
});
var p1 = m1.getPosition();
var p2 = m2.getPosition();
var distance = Math.round(p1.distance(p2));
console.log('两点距离:',distance);