STAY IN TOUCH

and receive our newsletter to get the latest news and tips.


Location

A Location instance represents a GPS location on earch. The latitude and longitude are defined in degrees. All the other fields are optional and might be invalid.

getting the current location

There are two actions to query the current location:
var loc := senses → current location
  • asks the device for an approximate location. The location might be slightly outdated or based on WiFi or cellular tower positioning.
var loc acc := senses → current location accurate
  • asks the device for the most precise location available. This is a hint and the device might still provide outdated data.
In both cases, the user might refuse to provide the location. In which case, the returned location is invalid. We recommend to test for this case in your script.
if loc → is invalid then
No location!
else ... end if

geo-lookup and reverse geo-lookup

The languages service provides an action to find a location from a civic address and vice versa.
var ms campus := locations → search location("One Microsoft Way, Redmond, WA, USA", "", "", "")
  • returns the geo-location of the given address. If the search fails, the returned value is invalid.
var ms civic address := locations → describe location(ms campus)
  • given a location, gives closest the civic address