Geocoding and Mapping Module for FileMaker Pro

  • 4

Geocoding and Mapping Module for FileMaker Pro

Tags : 

FileMakerMapping

Geocoding and Mapping Module for FileMaker Pro
By David Weiner

In the past few months we’ve had several projects that needed some basic mapping functions for FileMaker Go on iPad, and for one reason or another, never really made anything that was easily replicable. Realizing that we were more than likely going to need to do this again, we thought it was time to find a module of some sort that we could easily plug in as needed. Our aim was to have a simple way to take a group of addresses and create a map using the Google API in FileMaker, and that was all. Nothing fancy – just simple, elegant, and (ideally) ready-to-go out of the box.

Figuring (or perhaps hoping) there was somebody in the FileMaker community who had already done this and put it up online, I went looking for something we could borrow code and ideas from. I downloaded a variety of different demo files from forums here and there, but didn’t find anything satisfactory for our purposes. The best example I found was from a DevCon presentation in 2012 by Thomas Kunetz. Among the files included in the download was one that did exactly what we needed. It contained a few inefficiencies, it was tailored for a presentation, all the field and language settings were in French, and it took a while for us to reverse engineer a few parts of it, but it had some of the best and simplest code we could build from.

Starting with that, we built a new file from scratch, adapting the Google API code a bit and rewriting all the scripts for our purposes, while also using some features from FileMaker 13 (specifically, geocoding addresses on server instead of locally). We also built it with the intention of making it easy to plug into an existing FileMaker solution, distilling it down to only the essential components. For example, we wrote extra code specifically to avoid the need to add new summary or global fields.

Now we had a nice simple module that we could install in future projects, and since we recognized there was need for just such a module in the FileMaker community, we decided we’d release it under a Creative Commons license for free.

FileMaker Mapping Download

Enjoy! (And perhaps it goes without saying, but this file is free, and AppWorks makes no warranty, express or implied, for its performance or suitability for a given task.)


4 Comments

Craig Watson

December 6, 2016at 5:10 pm

Thanks so Much for this- I hooked in in my app and it works great. I do have a question. Did you experiment with changing the colors of the markers in the Generate new map script – Let ( [
LATLONG = “new google.maps.LatLng(” & $lat & “,” & $long & “)” ;
LOCATION = Substitute ( GetAsCSS ( $description & “¶” & $address & “¶” & $city & ” ” & $zip & “¶” & $state & “¶” & $country ) ; “\”” ; “‘” ) ;
MARKER = “{\”position\”:” & LATLONG & “, \”info\”: \”” & LOCATION & “\”}”
] ;

Case ( $lat and $long ; MARKER ; “” )
)
I have tried icon : -Then the color maker, but haven’t got it to work. Any suggestions?

David Weiner

December 7, 2016at 10:47 am

I did play around with it a bit, but we decided to release it in its basic form without, since we had no need for multi-colored markers at that point.

Take a look in the javascript that is set in the “Set Field [Geolocation_Globals::gHTML]” step in the “Generate New Map” script. In the javascript line that sets the var marker, you can add a different icon by changing the line to:

var marker = new google.maps.Marker({map:map,icon:’http://maps.google.com/mapfiles/ms/icons/green-dot.png’});

I believe you can also choose a custom web-located icon, instead of a Google provided one. It gets a bit more complicated if you want to specify different icons for different record types, as it involves re-writing some of the javascript, but it’s definitely possible.

Good luck!

Abbas Basui

February 11, 2017at 4:03 pm

Thanks you for that, is it possible to add a link in the infoWindow to go to related record or execute a script

    David Weiner

    February 13, 2017at 9:25 am

    Yes, it’s possible, but we haven’t ever tried it. We’re contemplating a version 2 of the geocoding module, so that’s something we might look into in future.

Leave a Reply

three + fourteen =