Address and LatLong data can be displayed on a Google Map. You can click a map pin to get driving directions.
The Service Log sample application uses maps.
LatLong data is represented as comma-separated decimal values in the form "44.2456, -122.3348".
LatLong data can be captured in a form field when editing or adding rows via the LatLong and ChangeLocation column types. The current location button on the LatLong input uses high-accuracy GPS location capture on your device, which is potentially time-consuming and battery-intensive. Using a ChangeLocation column or an AppFormula or Initial Value of HERE() for a LatLong column enables passive location capture within the form, but the accuracy may be reduced compared to using the current location button.
The XY column type represents a position within an image that you provide. When a Map view is configured with an XY-type MapColumn, it will display the image in place of the usual map.
To enable an XY Image map, change the column definition of your location data to 'XY', and add a link to your hosted image in the 'BaseImage' field.
KML (Keyhole Markup Language) is a file format used to display geographic data, most commonly on platforms like Google Earth or Google Maps, that allows for embedding and displaying location points, borders and shapes with different styles.
To enable a KML layer in your map, edit the column definition of any 'Address' or 'LatLong' column type, and add a link to a hosted KML file in the 'KMLFileUrl' field.
There are some constraints on the size of KML files that can be displayed:
- Maximum fetched file size (raw or compressed): 3MB
- Maximum uncompressed KML file size: 10MB
- Maximum number of network links: 10
- Maximum number of total document-wide features: 1000
- Maximum number of KML layers: 10 to 20
These constraints are established by Google Maps (we use the Google Maps library to display maps in AppSheet) and we do not have the ability to modify them. An example of a KML file that fits these constraints is: http://code.google.com/apis/kml/documentation/us_states.kml
Here are a couple of sites where you can find common government boundary KML files:
When you enter an address, always specify the complete address including the city, state (if any), and country. This makes it easier for Google Maps to locate the address.
If an address is not mapped correctly, look up the address on Google Maps to see if there is a problem with the address. If you add many addresses at once to the data source, there may be a delay before you see all the addresses appear on the map within the app because each address must be geocoded before its position can be displayed.
Each location is displayed as a map pin. For performance reasons only a limited number of pins can be displayed at once. If the total pins exceed the limit, the map will prioritize showing pins closest to the center of the current view. You can control the number of pins displayed by setting the "Maximum number of map pins" property on the UX>Options tab.
Maps can be displayed in road or aerial view.
The map can be zoomed and panned. By default, the map is zoomed to show all the pins. If your map includes locations in both Australia and Canada, it may be zoomed to show half the world!
You can click or tap a map pin to select it. When you select a map pin:
- The map centers on the selected map pin.
- Information about the selected map pin is displayed below the map or in a sidebar depending on the screen size. The sidebar displays a detail view of the record as you would see if selecting the row in a table view. The compact view displays a single deck view row at the bottom of the screen. Both detail views include a built-in driving directions action (car icon) that attempts to launch Google Navigation from the current location to that destination (iOS users will need to install Google Maps for this feature to work). They can both be configured using reference views.
Customizing Map Pins
You can customize the color and icon style of map pins using format rules. You can apply format rules selectively to format some map pins one way, and other map pins another way. This allows you to highlight certain map pins, or to categorize map pins into groups.
To customize map pins:
- In the editor, open the UX > Format Rules tab.
- Click "+New Rule" to create a new format rule.
- In the "For this data" dropdown, select the table containing the Address or LatLong field.
- In the "Then format these columns" dropdown select the name of the Address or LatLong field.
- In the "Highlight color" property enter the map pin color you wish. For example, "#FF0000" is red, "#00FF00" is green, "#0000FF" is blue, "FFFF00" is yellow, "00FFFF" is cyan, "FF00FF" is magenta, and so forth.
- In the "icon" dropdown, select the style of icon you wish. For example, "fa-car".
- In the "If this condition is true" property, enter a Yes/No expression. The format rule will be applied when the expression is true.
Create a format rule for each map pin format you wish. Specify the appropriate "If this condition is true" expression to apply that format rule to the map pins you wish.
You must install Google Maps on iPhone and iPad devices to obtain driving directions.
To obtain driving directions, click the map pin. A small car icon will appear at the bottom of the app. Click the car icon to activate Google Maps driving directions.
For more information regarding maps read this blog post on how to use maps to visualize addresses.