Map Provider Settings
Map Providers allow you to display geographic data and location information within your application. This document explains how to configure map settings, understand usage limits, and choose between available map provider options.
What You'll Learn
You'll discover how to set up your preferred map provider, understand geocoding functionality, monitor your map usage, and configure Google Maps integration if needed. This knowledge will help you effectively display geographic data and create location-based features in your application.
Configuring Map Providers
Access the Map Provider settings by navigating to the Settings > Map Provider page in the Builder.
Tip: To learn more about Knack's map elements, see our Map Elements article
The loading of map elements and geolocating address fields is included in the Trial, Pro, and higher-tier plans. Compare plans and features here.
Knack Default Maps
Knack provides the Knack Maps option by default as well as the option to use Google as your map provider. For more information on setting up Google Maps integration, please see our section on Using Google Maps.
View Map Usage
The View Map Usage button can help you see the totals of your map element loads and geocoding usage from address fields in records, as well as the source of these counts.
Geocoding of Records
The number of Address fields in a table where "Enable Geocoding" is selected in the fields' settings is multiplied by the number of records in that table that make up each table's "Total Count" number in the View Map Usage modal. The total shown ("Estimated number of monthly geocode requests") is the sum of the "Total Count" number for each table.
Map Element Loads
Each time a map element is loaded in a browser, this counts as a load. The number provided is the monthly average map element loads over the lifetime of the app, as of the current date.
Note: The loading of map elements and geocoding of address field values is included for Trial, Pro, and above plans. You can also use Google as your provider by adding your API key.
Geocoding of Records and Usage Basics
Geocoding is a process that involves taking the description of a place, such as its latitude/longitude coordinates or its address, and accurately mapping it to a physical location on the surface of the earth. To display address field values on a map element or search address field values with the "is near (a zip code)" filter, the address field setting of "Enable Geocoding" must be selected.
Note: "is near (a zip code)" filters can be used in the following locations within Knack: formula field filters, element source filters, element filter menus, or rule criteria (tasks, emails, record actions, and action links).
Tip: If address field values are to be used for display only on a record or element, there's no need to geocode them.
Calculating Distance
In Knack, we calculate the shortest distance between two points based on their longitude and latitude coordinates automatically. However, when viewing maps such as Google Maps outside of Knack, they calculate the shortest "route" or mileage between the two locations accounting for driving between two points.
Knack Default Map Feature
Using our default map feature, addresses are geocoded to a precision of five decimal places.
Partial searches (street address only, city only, or ZIP code only) are not supported with our default map feature. Guidance is provided for customers during map searches if no results are returned stating: "No results for that search. Please try again with additional address data (eg. street, city, state, zip, or country)."
Custom map pins are not currently available with Knack's default map feature. If you'd like to keep your current code for customized map pins, you'll need to choose Google Maps as the map provider.
Using Google Maps as the Map Provider
You can also use Google as your map provider by adding your Google Maps API key and Google Map ID. In choosing Google as your map provider, you will be responsible for paying Google for any usage beyond their free plan for your geocoding of records, map elements, and address autocomplete usage.
Note: Switching to Google Maps as the map provider will geocode all address fields at that time and every 30 days after that date.
Additional Options Available with Google Maps
- Google Maps provides seven decimal places of precision for geocoding
- Google Maps can provide search results on street addresses only, city only, and ZIP codes only
- Google Map pins can be customized using JavaScript
Note: As of 2024-01-29, any Knack apps that are using Google Maps as the map provider will require a Map ID to be entered in the App Settings > Map Provider section of the Builder.
Setting Up Your Google Maps API Credentials
1. Billing
Go to your Google Developer Account > Menu hamburger > Billing > Add Billing Information.
2. Enable APIs & Get Credentials to Use in Knack
- Create a new project in your Google developer account
- Enable "Geocoding API" from the API Library
- Enable "Places API" and "Maps JavaScript API" from Additional APIs
- Set up Credentials: Go to APIs & services > Credentials
- Create an API key and use it in Knack
3. Enter Credentials in Knack
On the Knack side, enter your Google Maps API Key and Google Map ID and click the "Save Settings" button.
Tip: You can use the same key for multiple apps - this will bill all usage from any app to that same credential. You can create multiple credentials though as well, if you want to see usage from particular Knack apps to particular credentials.
Google Maps Platform Billing
When viewing your Google Maps Platform billing, you'll see the charges outlined by Product and SKU:
- Geocoding API: Under the Places product > Geocoding API (Product) / Geocoding (SKU)
- Places API: Under the Places product > Places API (Product) / Autocomplete - Per Request (SKU)
- Maps JavaScript API: Under the Maps product > Maps and Street View (Product) / Dynamic Maps (SKU)
Notes & Troubleshooting
If you'd like to test using a Google Maps API key, we recommend testing with an empty app and following the links under the section above to get started. To test, simply manually add a few records with addresses that you think would benefit from testing.
When enabling Google Maps APIs, Google provides a warning: "This key is unrestricted. Restrictions help prevent unauthorized use and quota theft". While this risk does exist, based on Google's implementation requirements, it is not possible to restrict a key to both a set of domains (for map loading/address autocomplete) and an IP range (for geocoding), which are both a part of maps & geolocation features in Knack.
Updated 8 days ago