Over 46,000+ Business Solution Developers Find answers, ask questions, and connect with our community of business solutions developers, business owners and partners.
Mapping Directions from FileMaker Pro with Google Maps – FileMaker Today
Ever wish you could generate a Google Map pin map from your FileMaker database of things like:
a sales route
a customer list
a distribution list?
Not a complex Cluster Map of large numbers of addresses, as I have detailed in another blog post, but a simple reusable script to display small groups of locations as pins on a map. Well, so did I and I went looking for a method. I knew I had seen something like this before, but due to the vagaries of the Internet, and possibly poor search skills on my part, I couldn’t find exactly what I wanted. So I did what I usually do, I decided to build my own demo file and document it, so the next time I went looking for this technique, I would know where to look.
My goal was to make a simple modular and portable script that developers (myself included) could just paste into their solution and modify a few steps and have it up and running quickly. This demo is my attempt at this.
The demo file is a simple table with a batch of addresses from across Canada and the USA. This list is a very old list of companies in the computer industry that I found rummaging around on my hard drive. Some of the addresses are current, but some are not, and you will see how Google Maps handles this issue below.
Open the file, do a search on a small subset, keeping your Found Set at or below 25 addresses, and click the ‘Display Map’ button.
You can import your own data, or simply use the demo data to test the script.
Directions Pins in Google Maps
Note that Google will find errors in your data and display them like this: “Did you mean a different: <<Your Address Here>>?” The maps are only as good as your data, so some cleaning up may be required. Google Maps gets especially picky about Company names.
No company name specified
There are two variations of the $address variable in the script. Above is the ‘no company name’ version.
Company Names included in the address
Above is a screen shot of the script running with the $address variable set to include the Company name.
Note that there are more errors, because my list is so old and many of these companies no longer exist. Google Maps highlights the errors more because I have attached an incorrect company name to the address. When the companies do still exist, the pins on the map can be clicked on to reveal more information about the company.
Note that a URL for the company has been located by Google and displays in the pin popup. This information did not come from the URL string. Google matched the address and company name with existing information. There is also a Street View preview in the popup box.
The script to copy
Here are the steps to import this capability into your own database.
Copy the script “Google Map Directions for a Small Batch of Addresses” into your solution.
Modify Three Steps
Modify the three steps to customize the script to your solution:
The Go to Layout step — set it to a list view of your addresses.
The sort order — this the order that the addresses will be sent to Google via a URL, so order them how you would like the directions to go. Try postal or zip code.
The address fields. — there are two variants of this step. One of the steps is commented out and includes a field for a label, such as the Company name.
The script is pretty straightforward, it loops through the address records and builds a calculated URL which is passed to the default web browser. There are two error capture routines: 1) no more than 25 records and 2) no more than 2,048 characters can be in the URL. These are Google limits. If you need a bigger batch of addresses mapped, I encourage you to look at the Cluster Maps demo file linked above.
I hope you find this script and technique useful in your solutions.