Geolocation Actions
os.convertGeolocationToWhat3Words(location: ConvertGeolocationToWhat3WordsOptions): Promise<string>
Converts the given geolocation to a what3words address. Returns a promise that resolves with the 3 word address.
The first parameter is a ConvertGeolocationToWhat3WordsOptions and is the latitude and longitude that should be converted to a 3 word address.
Examples
Get the current geolocation as a 3 word addressconst location = await os.getGeolocation();
if (location.success) {
const address = await os.convertGeolocationToWhat3Words(location);
os.toast(address);
} else {
os.tost("Could not get geolocation");
}Get the location of the Amway Grand as a 3 word addressconst address = await os.convertGeolocationToWhat3Words({
latitude: 42.966824756903755,
longitude: -85.67309821404483,
});
os.toast(address);os.getGeolocation(): Promise<Geolocation>
Gets the geographic location that the current device is at in the world.
Returns a promise that resolves with the location.
Examples
Get the current geolocation.const location = await os.getGeolocation();
if (location.success) {
os.toast(`You are at (${location.latitude}, ${location.longitude})`);
} else {
os.toast(location.errorMessage);
}