1
嗨,我想知道如何找到openlayers中兩個標記之間的距離。如何找到openlayers中兩個標記之間的距離?
var distance = distanceBetweenMarkers(latLon1, latLon2){
//code to find the distance between latLon1, latLon2
}
pleae幫我...
嗨,我想知道如何找到openlayers中兩個標記之間的距離。如何找到openlayers中兩個標記之間的距離?
var distance = distanceBetweenMarkers(latLon1, latLon2){
//code to find the distance between latLon1, latLon2
}
pleae幫我...
創建一個從您的LonLat
分和Geometry.Point
調用distanceTo
方法[1]。
p1 = new OpenLayers.Geometry.Point(latLon1.lon,latLon1.lat);
p2 = new OpenLayers.Geometry.Point(latLon2.lon,latLon2.lat);
len = p1.distanceTo(p2);