Click, Display, Capture – Google Map Longitude & Latitude into FileMaker Pro

Update 2015-12-03 – If you have any issues with this demo, have a look at Sound Essentials blog entries. They seem to be improving on this concept.


Using a Javascript overlay on Google Maps and FileMaker’s URL scheme to channel those coordinates into FileMaker records. Click on a map, add longitude and latitude to FileMaker Pro.

This project was brought about by a customer request. They wanted a method of clicking on a Google Map and having the Longitude and Latitude come up that could then be cut and pasted into a FileMaker record. The project was for wildlife observation software sold as a FileMaker Runtime. Google has recently changed their Maps API (again) and it broke an existing method in the Runtime.

I am not sure who else this technique would be useful for, but I thought it makes for a cool demo of Javascript integration with FileMaker.

Click, Display, Capture Longitude and Latitude into FileMaker Pro

Click on the Google Map and have the Longitude and Latitude displayed in the on map grey box. The onclick Javascript also runs a FileMaker script that adds the coordinates to a FileMaker data table as a new record.

Demo File

HTML/Javascript Magic

I found a Javascript template for overlaying on Google Maps. It had the ability to click on a map location and display the coordinates in a grey box overlaid on the map. I got this working in FileMaker Pro. The customer was happy with this, because his customers were used to the copy/paste approach. I wasn’t satisfied however, thinking there must be a way to further automate this. With the help of some Internet searches and a couple of emails to a Javascript professor (my son Cory of Davander Mobile), I added this bit of code to the existing Javascript onclick call:

// Change the Database name and the Script Name here to integrate with your own solution:

var url = “fmp://$/HB-Get%20Map%20Coordinates?script=Get%20Coordinates&param=” + event.latLng ; window.location = url ;

Notes about Runtime

Cool as this technique is, it won’t actually work in FileMaker Runtime, since the application registers itself with the OS as the handler for URL scheme. The FMP protocol is specific to FileMaker Pro or FileMaker Pro Advanced.

Another approach I thought about was to send the contents of the longitude and latitude box in the Web Viewer to the clipboard and then use FileMaker script to paste it into a field. Apparently capturing the clipboard is a no-no in Javascript. My Javascript reference said: “Basically, because the clipboard is sensitive user space, scripts aren’t generally allowed to mess with it. Flash does have the ability to bring stuff directly into the clipboard, so that’s one way around that. There are tools like that are specifically for doing this.”



iOS/FileMaker Go


It seems that the Javascript onclick works in the Web Viewer works, but it brings up the keyboard, which seems to be blocking the script from running. Catch 22. If you turn off interactivity in the Web Viewer, the clicking is blocked. If you leave it on, it thinks you want to type in the Web Viewer and won’t let scripts run. You will see in the demo I attempted to attach an OnObject Enter script to the Web Viewer to turn off the Touch Keyboard, but it did not seem to do the trick.

Fortunately there are other ways to capture Longitude and Latitude on an iOS device, so no huge loss here. Still it would be nice to be able to control the iOS keyboard in a Web Viewer the way one can in a field.


I love the Internet. For a Javascript hacker like me (as opposed to someone who actually understands the language), it seems that someone has already done everything I am looking to do. Here are my sources for this file.

3 Responses to “Click, Display, Capture – Google Map Longitude & Latitude into FileMaker Pro”

  1. Super !!!!
    Is it possible to get the street and Number from house when clicking on the Building too ?

    thank you very much !


  2. Works perfect !
    Thank you very much Douglas !
    Greetings from Austria


%d bloggers like this: