[mapbox-gl] add LngLat.distanceTo (#43084)

This commit is contained in:
Dmytro Gokun
2020-03-13 18:32:08 -07:00
committed by GitHub
parent 8193cd43a0
commit cdc9c593eb
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -1056,6 +1056,10 @@ declare namespace mapboxgl {
/** Return a LngLat as a string */
toString(): string;
/** Returns the approximate distance between a pair of coordinates in meters
* Uses the Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159) */
distanceTo(lngLat: LngLat): number;
toBounds(radius: number): LngLatBounds;
static convert(input: LngLatLike): mapboxgl.LngLat;
+1
View File
@@ -687,6 +687,7 @@ expectType<mapboxgl.LngLatLike>({ lon: 0, lat: 0 });
new mapboxgl.LngLat(0, 0);
expectType<mapboxgl.LngLat>(mapboxgl.LngLat.convert(lnglatlike));
expectType<number>(new mapboxgl.LngLat(0, 0).distanceTo(new mapboxgl.LngLat(0, 0)));
/*
* LngLatBoundsLike