Advanced Math Module
The advanced_math
module provides distance calculation helper methods.
Distance calculation methods
Advanced Math provides a method that will display the distance, in miles, between two lat/long coordinates.
Usage: getDistance(lat1, lon1, lat2, lon2)
, where:
lat1
: latitude of the first pointlon1
: longitude of the first pointlat2
: latitude of the second pointlng2
: longitude of the second point
const advancedMath = require('advanced_math');
const distanceInMiles = advancedMath.getDistance(43.7001100, -79.4163000, 37.7749300, -122.4194200);
Degrees to Radians
Advanced Math provides a method that will convert degrees to radians.
Usage: deg2rad(deg)
, where:
deg
: input of degrees
const advancedMath = require('advanced_math');
const radians = advancedMath.deg2rad(30);
Functions support
Functions provides a rich set of tools, and this documentation does not cover all of the potential situations you may encounter. If you need help with a situation not covered by the documentation, please contact PubNub Support