Update documentation (#9745)

This commit is contained in:
mguinness
2025-06-06 09:27:22 -07:00
committed by GitHub
parent 5dba5e6854
commit 03cd98fc66
2 changed files with 2 additions and 2 deletions

View File

@ -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));
} }

View File

@ -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,