对应的openlayers的版本为3.7.
主要用的接口是ol.Sphere.haversineDistance([x1,y1],[x2,y2]);
4326坐标系中计算两点距离的方式为:
var wgs84Sphere = new ol.Sphere(6378137);
wgs84Sphere.haversineDistance(C1,C2);
示例为:
var wgs84Sphere = new ol.Sphere(6378137);
wgs84Sphere.haversineDistance([120.21592590991689, 30.210793016606],[120.21670777384473, 30.211168525868086]);
本文介绍如何使用 OpenLayers 3.7 版本中的 ol.Sphere.haversineDistance 方法来计算 WGS84 坐标系(EPSG:4326)下两点之间的地理距离,并给出具体的实现示例。

被折叠的 条评论
为什么被折叠?



