By Cath Kirkland, 18 July 2023
Wow, there are endless possibilities with Google Maps! But where do we even begin? In this demo, we'll show you just how effortless it is to find and display the travel time between any two locations using Google Maps.
Imagine this: you're using FileMaker Go, and in just a few clicks, you can instantly know your exact location and estimate the travel time to your next destination or important meeting.
Now, here's the slightly tricky part - getting your hands on a Google API key. If you don't have one don't worry we will take you through the steps of getting one. Let's get started and discover the benefits of this integration…
Are you ready to get started? Let's dive in!
If you already have one of these, then you can skip this whole section! If not then read on…
You will need to set up a Google API key. This involves creating a cloud.googe.com account and using a credit card.
In most cases usage rates fall in the free zone, mostly because Google currently gives you a $200 recurring monthly credit. Some of their rates are here:
Finding the right place to set up a Google API key can be a pain and you have to enable the services you want to use. But don’t worry once you have the API key it's smooth sailing from there!
1. Go to the Google Cloud Console https://console.cloud.google.com/projectselector2
2. Select a project, or create a new one.
3. Go to the APIs & Services > Credentials page.
4. Create Credential, select API key and choose the following options:
To finalise your changes, click Save.
When you set up your Google API key you do get the option to enable the services you want to use. If you are going to be using Google Maps integration for a multiple integrations in your FileMaker database we suggest setting up multiple keys. In the event that you do start to get charged you then have a little more visibility as to where those charges are driven from as the charges get linked to the API key. We didn't do this here but you know… you live and learn!
For more information on the services we use look here:
Get directions between locations, for driving, cycling, transit, and walking:
Convert addresses or Place IDs to latitude/longitude coordinates and vice-versa:
Uses cell phone towers to establish a gps location:
Build dynamic, interactive, deeply customized maps, location, and geospatial experiences for your web app:
Get location data for over 200 million places, and add place details, search, and autocomplete to your apps:
Download the demo file and enter your own API key.
The main block of code contains a couple of substitutes. We have inserted tags into the code to make it simple to substitute with your own data. The minimum data you will need is the
The code also contains the name of a script which will get called when the map loads in a webviewer. The time is passed as a script parameter in seconds.
The script name in the example file is called:
You can customise this to call your script by changing the name directly in the map code.
In our example we demonstrate the travel time in New York City across central park. Changing the mode of transport re-calculates the optimal route and estimated travel time for the 4 modes Google allows you to select.
Note: For each mode to work there does have to be sufficient google data to revaluate the route. For instance biking mode does not work in Christchurch, NZ due to a lack of google data.
40 minutes to walk from The Metropolitan Museum of Art to Times Square.
29 minutes by public transport
13 mins to drive
But the winner was 12 minutes to bike between the two points.
Compare some other locations in our demo file or add your own.
Using FileMaker Go this is simple to work out as we can use the FileMaker Function
Where 200 represents the accepted accuracy in meters and 10 represents the maximum acceptable time in seconds since the location was last looked up. This function returns a delimited list of location information where:
1st value = latitude
2nd value = longitude
On non-iOS devices you could use Geolocation API which uses cell phone towers to establish a gps location.
In reality to use this integration your contact addresses have to be GPS’ed. There are two main ways to do this.
That choice will be up to you. There is code in the example file which will retrospectively loop through a bunch of addresses and use the Google Places API to code them.
Alternatively you can use a widget like Google address validator in a web viewer to enter and code addresses as you go.
Hope you found this interesting. Download our file and have a play.
As mentioned, we always include an example file with our articles to help you learn and explore. We spend a lot of time on these so please do check it out.