The map view allows you to display locations within your app. Depending on the app requirements, you can display location data, drop pins, and provide directions with your app.
Maps can be displayed in road or aerial view and 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.
The location data points can come from Address
,LatLong
(GPS) information, or XY
(coordinates of a point). You can use either Google maps to display your mapped locations (Address
and LatLong
) or a custom image such as the interior map of a manufacturing plant to map XY
points.
The following sections describe how to create, configure, and customize map views:
- Get started using map views
- Create a map view
- Configure the map view options
- Use map pins
- Get driving directions
- Use your Google Maps integration
- Use KML layers to display geographic data
- About map view location data points
Get started using map views
Get started using map views by viewing the Active Jobs map view in the Field Delivery sample app
Create a map view
To create a map view:
- Create a view, as described in Create a view.
- Select map as the View type when configuring the card view details, as described in View details.
- Configure the map view options.
- Configure the Display, Behavior, and Documentation settings, as described in Configure the view.
- Save your app.
Configure the map view options
Configure the map View options by using the settings described in the following table.
Setting |
Description |
Map column |
Select column to use for location data from the drop-down. See also About map view location data points. |
Secondary data table |
Optional. Select a table that defines a secondary data layer for the map. |
Map type |
Select the type of map to show. Options include:
|
Location mode |
Select how frequently you want to update your current location on the map.
|
Minimum cluster size |
Set the pin cluster size. When the number of pins occur in close proximity, they will be displayed as a single cluster for improved performance. Set to 0 to disable clustering. |
Use map pins
Each location is displayed as a map pin. 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 using one of the following views depending on the screen size:
- Sidebar view - Detail view of the record; the same view displayed when selecting the row in a table view.
- Compact view - Single deck view row at the bottom of the screen.
Each view includes a built-in driving directions action (car icon) that will launch Google Navigation from the current location to that destination. (iOS users will need to install Google Maps for this feature to work). The views can be configured using reference views.
You can customize the map pins, as described in the following sections:
- Control the number of pins displayed
- Customize the pin color and icon style using format rules
- Show or hide points of interest
Control the number of pins displayed
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 using the Map pin limit setting when configuring global map view settings.
Customize the pin color and icon style using format rules
Customize the color and icon style of map pins using format rules. You can apply format rules selectively to format a set of 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 get started, watch the following video.
To customize map pins:
- Open the app in the editor.
- Go to App > Format Rules and click + in the Format rules heading to create a new format rule.
We've made some improvements to the app editor.
You are opted in to the new editor by default, but you can switch back to the legacy editor at any time.If you are using the legacy editor
Go to UX > Format rules and click +New Rule to create a new format rule. - In the For this data drop-down, select the table containing the
Address
orLatLong
field. - In the Then format these columns list, select the name of the
Address
orLatLong
field. - In the Highlight color setting, enter the map pin color you wish by specifying its hex color code. For example,
#FF0000
for red,#00FF00
for green,#0000FF
for blue,#FFFF00
for yellow,#00FFFF
is cyan,#FF00FF
is magenta, and so forth. - In the Icon setting, click the preferred icon.
- In the If this condition is true setting, enter a
Yes/No
expression. The format rule will be applied when the expression isTRUE
.
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.
Show or hide points of interest
Show or hide points of interest on the map view by using the Hide points of interest setting when configuring global map view settings.
Get driving directions
To get 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.
Use your Google Maps integration
Use the Google Maps key from the account settings for geocoding requests by using the Use my google Maps integration setting when configuring global map view settings.
Use KML layers to display geographic data
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 learn more about KML, review this Community post.
To enable a KML layer in your map, edit the column definition of any Address
or LatLong
column type to add a link to a hosted KML file in the Optional Url form KML File setting.
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; AppSheet doesn't have the ability to modify them.
Download an example of a KML file that fits these constraints: https://code.google.com/apis/kml/documentation/us_states.kml
Here are a couple of sites with interesting KML files:
About map view location data points
Map view location data points can come from an address, LatLong (GPS) information, or XY (coordinates of a point).
Address data
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. A column header called Address will help AppSheet identify the column more efficiently.
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.
LatLong data
LatLong
data is represented as comma-separated decimal values, as in: 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 app formula or initial value expression 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.
XY data
The XY
column type represents a position within an image that you provide. When a map view is configured with an XY
-type Map
column, 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 (as quoted text or an expression) in the Background image for the XY coordinates setting.
The following video shows how to use custom maps by using the Background image for the XY coordinates setting.