Read Geo Data
The Read Geo Data action enters the current geolocation data into the $MT_GEOLOCATION tree. In order for the action to be able to read the current geolocation, the mobile device's geolocation tracking must have been started before this action is executed.
The $MT_GEOLOCATION tree is automatically added to the page sources of the page when the Start/Stop Geo Tracking action or the Read Geo Data action is added to design. The $MT_GEOLOCATION tree has two parts: Location and Address (see listings below). The Location element contains the geolocation coordinates. The Address element contains the address equivalent plus other details of the geolocation coordinates as determined by a directory look-up. If no postal address equivalent is available, then this part of the tree will not be filled; other child elements of Address (such as URL) might also not be filled if the relevant data is not available.
$MT_GEOLOCATION
<Root>
<Location/>
<Address/>
</Root>
$MT_GEOLOCATION <Root> <Location Provider="" Latitude="" Longitude="" Geolocation="" Altitude="" AccuracyVertical="" AccuracyHorizontal="" Speed="" Time="" MagneticHeading="" /> <Address Locality="" SubLocality="" CountryName="" CountryCode="" PostalCode="" AdminArea="" SubAdminArea="" FeatureName="" Thoroughfare="" SubThoroughfare="" Phone="" Url="" Premises=""> <AddressLine></AddressLine> ... <AddressLine></AddressLine> </Address> </Root>
|
Geolocation retrieval options
In the dropdown box of the action's setting, you can select one of the following:
•Current Geolocation: Enters the mobile device's geolocation data in the Location element of the $MT_GEOLOCATION tree. Only the tree's Location element attributes will therefore contain data. The tree will not have an Address element.
•Current Geolocation + Address: Enters data into both the Location and Address element nodes.
•Address at Given Geolocation: Enters Address element data in the $MT_GEOLOCATION tree. This data corresponds to the For Geolocation coordinates you enter. The For Geolocation coordinates must be entered as a string having one of the lexical formats described in the Geolocation input string formats section below.The address data is obtained by looking up a geolocation directory.
•Geolocation at Given Address: Geolocation coordinates are fetched for the string that you enter as the value of the For Address field. This string is looked up in a geolocation directory, and if coordinates for this address are available, then the Location element of the $MT_GEOLOCATION tree is updated with these coordinates. You can enter any sub-part of the address for the directory lookup.
The geolocation input string must contain latitude and longitude (in that order) separated by whitespace. Each can be in any of the following formats. Combinations are allowed. So latitude can be in one format and longitude can be in another. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).
Note: If single quotes or double quotes are used to delimit the input string argument, this will create a mismatch with the single quotes or double quotes that are used, respectively, to indicate minute-values and second-values. In such cases, the quotes that are used for indicating minute-values and second-values must be escaped by doubling them. In the examples in this section, quotes used to delimit the input string are highlighted in yellow (") while unit indicators that are escaped are highlighted in blue ("").
•Degrees, minutes, decimal seconds, with suffixed orientation (N/S, E/W) Example: 33°55'11.11"N 22°44'55.25"W
•Degrees, minutes, decimal seconds, with prefixed sign (+/-); the plus sign for (N/E) is optional Example: 33°55'11.11" -22°44'55.25"
•Degrees, decimal minutes, with suffixed orientation (N/S, E/W) Example: 33°55.55'N 22°44.44'W
•Degrees, decimal minutes, with prefixed sign (+/-); the plus sign for (N/E) is optional Example: +33°55.55' -22°44.44'
•Decimal degrees, with suffixed orientation (N/S, E/W) Example: 33.33N 22.22W
•Decimal degrees, with prefixed sign (+/-); the plus sign for (N/S E/W) is optional Example: 33.33 -22.22
Examples of format-combinations:33.33N -22°44'55.25" 33.33 22°44'55.25"W 33.33 22.45 |
•Geolocation at Given Address: Returns the geolocation of the address submitted in the For Address option. The address is entered as a string, for example: "Address Line 1, Address Line 2". This string is submitted for a geolocation lookup, and the returned geolocation data components are stored in the $MT_GEOLOCATION tree (see the tree structure listing at the beginning of the section).
Usage
In order to use geolocation data, it must first be entered in the $MT_GEOLOCATION tree with the Read Geo Data action. The screenshot below, for example, shows a Read Geo Data action that enters data for both the Location and Address elements. It then accesses the Location/@Latitude data in the $MT_GEOLOCATION tree to update a node in another tree.
The geolocation data that is retrieved from the different mobile devices is placed in the $MT_GEOLOCATION tree as numbers. The units and dataypes of these numbers are given in the table below.
|
For information about specifying geolocation data for designer and server simulations, see the section Geolocation Settings.
The tutorial Sharing Geolocations shows how the Read Geo Data action can be used.
MobileTogether extension functions
MobileTogether provides a range of XPath extension functions that have been specifically created for use in MobileTogether designs. Some functions can be particularly useful with specific actions. For example, mt-available-languages() returns the languages in which the solution is available and could, for example, be used with the Message Box action. If a function is especially relevant to this action, it is listed below. For a full list of extension functions and their descriptions, see the topic MobileTogether Extension Functions.
mt-geo-map-marker()
mt-geolocation-started()