geo

geo

Methods

(static) distance(positionOne, positionTwo)

Source:
Get the distance between two geo location points
Example
const meters = await sdk.geo.distance({lat, lon}, {lat, lon})
// Returns 634
Parameters:
Name Type Description
positionOne Object The first position
Properties
Name Type Description
lat Number The first positions latitude
lon Number The first positions longitude
positionTwo Object The second position
Properties
Name Type Description
lat Number The second positions latitude
lon Number The second positions longitude

(static) getDefaultCountry()

Source:
Retrieves the default country for the current user/application will attempt to retrieve the country from the user or application's organisation or from services available within the browser
Example
const result = sdk.geo.getDefaultCountry()
// Would return something similar to:
// { code:'AU', name:'Australia' }

(static) getDefaultTimezone()

Source:
Retrieves the default timezone for the current user/application will attempt to retrieve an accurate timezone either from the user's organisation or available services within the browser
Example
const result = sdk.geo.getDefaultTimezone()
// Would return something similar to:
// Australia/Melbourne

(static) getPosition(callback)

Source:
Start watching the user's geolocation
Example
const position = await sdk.geo.getPosition()
// Returns {coords:{latitude, longitude, altitude, accuracy, ...}}
Parameters:
Name Type Description
callback function A function that will be called with updated position data

(static) stopWatchPosition(watchID)

Source:
Start watching the user's geolocation
Example
const result = await sdk.geo.stopWatchPosition(watchID)
// Returns true after the watcher has been stopped
Parameters:
Name Type Description
watchID String the id of the watcher to stop

(static) watchPosition(callback)

Source:
Start watching the user's geolocation
Example
const result = await sdk.geo.watchPosition(callback)
// Returns {id:<watcherID>}
Parameters:
Name Type Description
callback function A function that will be called with updated position data