mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-21 23:26:12 +00:00
Update documentation (#9745)
This commit is contained in:
@ -136,7 +136,7 @@ export class LatLng {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @method distanceTo(otherLatLng: LatLng): Number
|
// @method distanceTo(otherLatLng: LatLng): Number
|
||||||
// Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).
|
// Returns the distance (in meters) to the given `LatLng` calculated using the [Haversine formula](https://en.wikipedia.org/wiki/Haversine_formula).
|
||||||
distanceTo(other) {
|
distanceTo(other) {
|
||||||
return Earth.distance(this, new LatLng(other));
|
return Earth.distance(this, new LatLng(other));
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ export class Earth extends CRS {
|
|||||||
// see https://rosettacode.org/wiki/Haversine_formula
|
// see https://rosettacode.org/wiki/Haversine_formula
|
||||||
static R = 6371000;
|
static R = 6371000;
|
||||||
|
|
||||||
// distance between two geographical points using spherical law of cosines approximation
|
// distance between two geographical points using Haversine approximation
|
||||||
static distance(latlng1, latlng2) {
|
static distance(latlng1, latlng2) {
|
||||||
const rad = Math.PI / 180,
|
const rad = Math.PI / 180,
|
||||||
lat1 = latlng1.lat * rad,
|
lat1 = latlng1.lat * rad,
|
||||||
|
Reference in New Issue
Block a user