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', () => {
});
it('should accept a referencePlace', () => {
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 {
* Compute distance and azimuth from place to reference place.
*
* @param place
* starting place.
* destination place.
* @param referencePlace
* optional destination place.
* optional starting place.
* @return
* 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.
*/
export function getDistanceAzimuth(
......@@ -32,13 +32,13 @@ export function getDistanceAzimuth(
const distAz = calculator.azimuth(
{
elv: 0,
lat: place.latitude,
lng: place.longitude
lat: referencePlace.latitude,
lng: referencePlace.longitude
},
{
elv: 0,
lat: referencePlace.latitude,
lng: referencePlace.longitude
lat: place.latitude,
lng: place.longitude
}
);
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