Looking for information about TrueContext features and functionality? Visit our Product Documentation Portal.
- About
- Google/Apple Maps URLs
- Bing Maps URLs
- Dispatch a Map Link with Coordinates Collected in a Form
About
Using the Data Type Launcher functionality, it is possible for a mobile user to launch a map in their web browser (or in a map app) using a correctly formatted map URL. This feature allows administrators to dispatch an address (such as a mobile user's next site visit) and accompany it with a map to aid their users in navigating to the address. Alternatively, users can manually enter their own URL into the form, and launch the map in their web browser or an app.
Using a Map App
The first time a user launches a map URL from ProntoForms, they may be asked if they would like to open it in a web browser or in the corresponding app, if there is one (i.e. A http://maps.google.com URL will prompt the user to open it with the Google Maps app). If this app is not installed, the user will be prompted to install it or open the URL in a web browser. Some apps can open URLs intended for other mapping services (Google Maps can open an Apple Maps URL).
Configuring the Form
The availability of this feature to users is controlled on a per-question basis the Form Builder. The default options are configured to allow the launcher functionality. Please note that a URL (including a map URL) only be launched from a question with a URL data type -- a URL entered in a simple text textbox, for example, will be read as a string of text rather than a URL, and therefore cannot be launched.
To turn on the URL launcher, mouse over a question with a URL data type and select Edit Properties. Enter the URL Properties tab and check off both "Allow the user to click the address to open the link" and "Open the link in the user's external browser."
If the same URL should be provided to users every time they use the form, add the URL as a default value for the question. This is also found under Edit Properties, in the Text Properties tab.
Google Maps or Apple Maps URLs
While the examples below show a Google Maps URL, Apple Maps URLs are formatted the same way. Simply replace maps.google.com with maps.apple.com. Note that if the Google Maps app is on the device and has been previously used to open map URLs from ProntoForms, Apple Maps URLs may still open in Google Maps by default.
Formatting Tips:
- Be sure to use a ? before the first parameter in all cases. Additional parameters do not require this.
- Characters must be URL encoded. Replaces spaces with a +.
- Separate parameters (such as a start and end point) with a &.
- This resource provides information on additional parameters such as "near", traffic overlays, etc. It is also possible to select a terrain type, zoom level, etc.
Location Search
- Format: http://maps.google.com/?q=your+query
- q= indicates a query. Anything entered after this will behave as if entered into the Google Maps query box.
- Example: http://maps.google.com/?q=100+Main+Street+Buffalo+NY
Get Directions Using an Address
- Format: http://maps.google.com/?&daddr=End+Point+Address
- daddr= indicates a destination (end) address.
- Only an end point is required, provided the user selects the "Allow Google Maps to Use My Current Location" option when prompted.
- Example: https://maps.google.com/?daddr=Parliament+Hill+Ottawa
- Optionally use saddr= to indicate a start point.
- Example: https://maps.google.com/?saddr=535+Legget+Drive+Kanata+Ontario&daddr=Parliament+Hill+Ottawa
Coordinates
Coordinates must be in a decimal format. Latitude must come before Longitude.
- Location Search: https://maps.google.com/?q=45.424807,-75.699234
- Use q=loc= followed by the coordinates (separated by a comma).
- Driving Directions: https://maps.google.com/?daddr=45.424807,-75.699234
- daddr= indicates a destination (end) address.
- Only an end point is required, provided the user selects the "Allow Google Maps to Use My Current Location" option when prompted.
- Optionally use saddr= to indicate a start point.
- Example: https://maps.google.com/?saddr=45.34802,-75.91903&daddr=45.424807,-75.699234
Bing Maps URLs
This resource provides more parameters for use in Bing Maps URLs.
Formatting Tips:
- The base URL for Bing Maps is http://www.bing.com/maps/default.aspx
- Be sure to use a ? before the first parameter in all cases. Additional parameters do not require this.
- Characters must be URL encoded. Replaces spaces with a %20.
Get Directions Using an Address
- Format: http://www.bing.com/maps/default.aspx?rtp=~adr.End%20Address
- ~adr. specifies the destination (end) address. The user will be prompted to allow Bing to use their current location as the starting address.
- Example: http://www.bing.com/maps/default.aspx?rtp=~adr.Parliament%20Hill%20Ottawa
- Optionally add a start address with rtp=adr. (followed by the start address) then ~adr. (followed by the end address)
- Example: http://www.bing.com/maps/default.aspx?rtp=adr.535%20Legget%20Drive%20Kanata~adr.Parliament%20Hill%20Ottawa
Dispatch a Map Link with Coordinates Collected in a Form
All of the above examples discuss dispatching a URL that involves a hard-coded end point. This can be useful if an administrator is creating individual dispatches in the office. If your workflow involves use of the dispatch data destination, however, it is possible to dynamically pull coordinates from the original form, and use them to create a URL to launch a map in the target form. This functionality could be useful in any two-step work process - for example, if an estimate form is completed on the first visit to a site, and a worker needs to return to the same site later for the completion of a work order or invoice.
Configure the Dispatch Data Destination
All items relevant to this specific configuration are fund in the Dispatch Data tab of the data destination options. You may optionally want to configure filtering, so that the Data Destination only executes if an answer like "Follow-up visit required?" is marked "Yes." Read more about configuring data destination filtering.
Dispatch Data
Label: The label of the question the URL should be dispatched to
Data Expression: The URL in full, including the DREL expression
Note: Format the base URL as discussed above to launch in the appropriate map application.
Important things to note about the DREL expression:
- Note that the latitude and longitude properties need to be separated out. Two separate references to the question in the original form with the label "GPS" are being made here. The two references must be separated by a comma.
- While URLs dispatched through the web portal are validated to ensure correct format, URLs dispatched through the Dispatch data destination are not. Therefore, it is up to you to ensure that there is no leading space in your data expression, and no space between the latitude and longitude properties. URLs cannot contain spaces and if your data expression includes a space, nothing will be dispatched to a textbox with a URL data type.
- While %a[GPS][coordinates] is a valid DREL expression, map applications cannot use the value of the "coordinates" property to map a location. This is because "coordinates" contains three strings: latitude, longitude, and altitude. Map applications can only handle latitude and longitude.
The above Data Expression would dispatch a URL to map that simply shows the location determined by the coordinates. Other data Expression options are below.
Launch a map providing directions from Device's current location to Dispatched Coordinates
https://maps.google.com/?daddr=%a[GPS][coordinates.latitude],%a[GPS][coordinates.longitude]
Comments
0 comments
Please sign in to leave a comment.