Openlayers3 计算map上任意两点间的距离

Openlayers3 计算地图上任意两点间的距离

主要用的接口是new ol.Sphere(6378137).haversineDistance([x1,y1],[x2,y2]);
4326坐标系中计算两点距离的方式为:
var a = new ol.Sphere(6378137).haversineDistance([120.21592590991689, 30.210793016606],[120.21670777384473, 30.211168525868086]);