Commit 87431e89 authored by Jeremy M Fee's avatar Jeremy M Fee Committed by Edward J Hunter
Browse files

Reverse azimuth correction, so it starts from reference place

parent 602c5be0
...@@ -49,7 +49,7 @@ describe('DistanceAzimuthPipe', () => { ...@@ -49,7 +49,7 @@ describe('DistanceAzimuthPipe', () => {
}); });
it('should accept a referencePlace', () => { it('should accept a referencePlace', () => {
expect(pipe.transform(place, referencePlace)).toEqual( expect(pipe.transform(place, referencePlace)).toEqual(
'447.3 km (277.9 mi) N' '447.3 km (277.9 mi) S'
); );
}); });
}); });
......
...@@ -13,12 +13,12 @@ export interface DistanceAzimuth { ...@@ -13,12 +13,12 @@ export interface DistanceAzimuth {
* Compute distance and azimuth from place to reference place. * Compute distance and azimuth from place to reference place.
* *
* @param place * @param place
* starting place. * destination place.
* @param referencePlace * @param referencePlace
* optional destination place. * optional starting place.
* @return * @return
* When reference place is specified: * When reference place is specified:
* calculate direction and azimuth from place to referencePlace. * calculate direction and azimuth from referencePlace to place.
* Otherwise return distance and azimuth from place. * Otherwise return distance and azimuth from place.
*/ */
export function getDistanceAzimuth( export function getDistanceAzimuth(
...@@ -32,13 +32,13 @@ export function getDistanceAzimuth( ...@@ -32,13 +32,13 @@ export function getDistanceAzimuth(
const distAz = calculator.azimuth( const distAz = calculator.azimuth(
{ {
elv: 0, elv: 0,
lat: place.latitude, lat: referencePlace.latitude,
lng: place.longitude lng: referencePlace.longitude
}, },
{ {
elv: 0, elv: 0,
lat: referencePlace.latitude, lat: place.latitude,
lng: referencePlace.longitude lng: place.longitude
} }
); );
azimuth = distAz.azimuth; azimuth = distAz.azimuth;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment