Brian Dunning's FileMaker Custom Functions

fnGoogleMap ( Address ; City ; State ; Zip ; Zoom )

(updated: 2/18/2015 - fixed for recent Google changes) Shows embedded (map only portion) Google Map within a web viewer object. No API required!

  Average rating: 3.9 (81 votes) Log in to vote

Jeremy Upton   Jeremy Upton
DME Supply Group
http://www.dmesupplygroup.com

Share on Facebook Share on Twitter

  Sample input:
fnGoogleMap ( 1600 Pennsylvania ; Washington ; DC ; 20500; 12 )
  Sample output:
http://local.google.com/maps?q=1600pennsylvania,Washington,DC,20500&z=12&output=svembedmfe&iwloc=0

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

***Recent change*** The last part of the function changed to "&output=svembedmfe&iwloc=0". This fixes the error "The Google Maps Embed API must be used in an iframe." (Thanks, Zorba)

Use this function to define a custom web address within a web viewer object. It will display an embedded map from Google Maps instead of the entire page as with the standard Google Maps output included with Filemaker. There is no need for any Google API.

The last variable "Zoom" sets the default zoom level of the embedded map. It supports values from 1-19. 1 has the least detail with 19 having the most.

 

Comments

Teg Bains   Teg Bains, Richmond, BC
Nov 25, 2009
Thanks for this function! It works much nicer than the FM 10 version!
 
Phil Feldman   Phil Feldman, Mobile, AL
Jun 3, 2010
Great function. Solved my needs immediately. Anyone know of a similar function that can map multiple locations?

Phil Feldman
 
Shai   Shai, Israel
Aug 5, 2010
Try to add country but got error message. Any idea ?
thanks
 
Jeremy   Jeremy, Memphis, TN
Aug 5, 2010
Shai,
As is this function only supports United States addresses. Though it could probably be modified for international use.
 
Daniël Boeije   Daniël Boeije, Heemstede, The Netherlands
Jun 9, 2012
Rewrote the link for viewing Dutch locations within several layouts, works perfect.

A little tip: be as specific as possible to get the best results. For Dutch coders it would be the full address with postcode, since we Dutch like to have the same townnames in several provinces.
 
Marilyn   Marilyn, Brisbane, Australia
Jun 11, 2012
My problem is that if no such address is found, then the map defaults to the middle of Kansas. How can I get it to just show the correct state or city (not the actual street address)? We work in new subdivisions and sometimes the street hasn't made the map yet.
Cheers
Marilyn
 
Ron   Ron, San Rafael, CA
Jul 5, 2012
AWESOME. Perfect for my FMP solution. Thank you.
 
Jeffrey Cannon   Jeffrey Cannon, Chicago, IL
Oct 15, 2012
What about using mulitple addresses and putting pushpins on a map? My situation is that I want to use the address of a current record and see that pushpin, say in downtown Chicago. Then I want to add a layer of pushpins of locations that are in proximity. Say 10 pins max within X miles of the record location. This is probably a much bigger problem that should be addressed here, right? Email me offline at jeffrey@filemakerproguy.com or call 312-961-4742 if you please.
 
Tilak   Tilak, sw
Jan 28, 2013
Good...
 
Amy   Amy, Hudson, WI
Feb 21, 2013
Keeps saying "ZOOM" table not found? Why would I need to create a table for zoom?
 
Jeremy   Jeremy, Memphis
Feb 22, 2013
Amy,
It's difficult to say for sure, but it sounds like you may be trying to place the the custom function calc directly in the web viewer definition. If this is the case, you will need to create the custom function, then place the function itself in the web viewer definition.
 
Mike   Mike, Chicago
Mar 12, 2013
I am experiencing the same Zoom table not found issue and am in the manage custom function of filemaker pro advanced. Any help or thoughts are much appreciated!
 
Jeremy   Jeremy, Memphis
Mar 12, 2013
Mike & Amy,
I have not been able to reproduce the error. What versions of FMPA are you using? I am still using 11. If you are using 12, it is possible there are changes that effect this custom function, though I am not aware of any such changes. If not, the only advice I can give at this point is simply make sure to enter the function exactly (quotes "" and all).

I am sorry I cannot be of more help. If you figure out the issue please post it here and I will make any needed changes.
 
Mike   Mike, Chicago
Mar 14, 2013
I am on 12, and copied and pasted exactly from above into edit custom functions. Thanks for taking the time to reply, would be great if anything else comes to mind.
 
Graham   Graham, UK
Mar 15, 2013
I took out '& Zoom' and it work absolutely fine for me.
 
Mike   Mike, Chicago
Mar 16, 2013
i removed zoom and it works now too. thanks everyone
 
Michael   Michael, Chicago
Mar 21, 2013
Thanks! Was exactly I was looking for!
 
RolandLondon   RolandLondon, London
Mar 23, 2013
Just put Zoom inside "" and it works fine:
"http://maps.google.com/maps?q=" & Address & "," & City & "," & State & "," & Zip & "&z=" & "Zoom" & "&output=embed&iwloc=0"
 
Jeremy   Jeremy, Memphis
Mar 25, 2013
Roland, in this case aren't you just passing "Zoom" as text? As in "&z=Zoom" rather than an actual value for [Zoom] such as "&z=10". What I'm asking is, does your fix actually allow for the use of the variable [Zoom] field as intended or does it simply stop FM from returning the error?

I'm unable to test this on my own as I am using FMPA 11.
 
RolandLondon   RolandLondon, London
Apr 22, 2013
You are right. I now just put in a default value for zoom.

The problem I'm now having is that maps show fine on desktop versions of FM but not on FMgo!
 
Mike Williamson   Mike Williamson, Lyons, KS
May 3, 2013
Can this be adapted to show 10 or 20 addresses on a single map?

mikewson@mac.com
 
Jeremy   Jeremy, Memphis
May 6, 2013
Mike,
I believe there is a way to show multiple addresses, though I have not looked into it in a long while. However, the limitation to using a URL call to display multiple addresses is that you eventually hit the max character count allowed by Google. It is doubtful that you would be able to get to even 10 addresses before hitting that ceiling.

To get the functionality you are looking for you will likely need to use Google API.
 
John   John
May 20, 2013
Could you explain "&output=embed&iwloc=0" in detail?

I assume the "output=embed" is the part the removes the clutter around the map that is shown on google's normal map page such as the left-hand navigation the top row navigation.

Am I half-way right there?

But what does the "iwloc=0" do?

I tried changing the "0" to "1" but I couldn't tell any difference.
 
John   John
May 20, 2013
I just found that you can add
"&t=" & type
to the custom function to specify if it will be map, satellite, hybrid, terrain, or earth view.
&t=m is for default map aka street map
&t=k is for satellite view (no roads labeled or identified)
&t=h is for hybrid (satellite with streets identified and labeled)
&t=e is for earth view

I guess instead of the word "type" you could use the word "map" or any other word in the function as long as it was listed as one of the paramaters.

I thought this was neat and hope somebody else finds it useful. I'm very new to custom functions and making URLs for google maps and i'm not a programmer so please forgive any errors I might have made.
 
Jeremy   Jeremy, Memphis
Jun 4, 2013
John,
I actually do not know what that little tag does either. It's a tiny bit of coding I picked up a long time ago from some work I saw in a similar FM solution. All I know is that when it's there it works. Maybe someone else can shed some light on it.

There are a number of different tags that can be added to change all kinds of aspects of the Google map that gets drawn, "type" being one of them. Some require the use of API. Thanks for pointing that one out though. It's definitely among the more useful ones.
 
Josh   Josh, Hanover Twp.
Jul 5, 2013
Is there a way to show a custom Google map using the code above. I need to insert a map using the example above, but using a custom made google map.
 
Jeremy   Jeremy, Memphis
Jul 5, 2013
Josh,
To my knowledge, the kind of thing you are wanting to do will require the use of Google API.
 
Josh   Josh, Hanover Twp.
Jul 8, 2013
Jeremy,

Thanks for the info, now just need to find a way to get my API, google says it isnt needed anymore.
 
Sean   Sean, Private
Jul 13, 2013
Hi Jeremy.

I'm feeling really foolish. Using FM 12. New to Custom Scripts.

Creating a new custom function, carefully pasting into the edit custom function I get an error "The specified parameter cannot be found" It then highlights Address

Please could someone walk me through this? Definitely think I'm missing a step or two here.

Many thanks.

Sean
 
Jeremy   Jeremy, Memphis
Jul 15, 2013
Sean,
It sounds like you are not pointing the 'Address' variable to any field. When you are actually using the function 'Address' will be replaced with the field name in your database that contains the address data. (Ex: Customers::Address)

The same will be done for each of the variables with exception of 'Zoom'. There you will simply put in a number.
 
Josh   Josh, Hanover Twp.
Jul 17, 2013
Can someone tell me how to use Google API so I can use a custom map that I added markers to.
 
sowmiya   sowmiya, madurai
Aug 6, 2013
i am going to erode
 
Steve   Steve, Lancaster
Aug 25, 2013
Many of the posters are asking about multiple markers. Check this out straight from FileMaker. Worked great for me.
https://fmdev.filemaker.com/docs/DOC-3321
 
Molly   Molly, birmingham mi
Nov 24, 2013
Hi,
Thanks for this, worked great. I need the map to show how far the address is from my shop (not just where it is on the map) do you know how I can get it to do that?
thank you
 
Jim Steed   Jim Steed, Canton, MI
Mar 5, 2014
This worked great until Google changed to the new look about 3 weeks ago. Now it is broke. Any Idea how to fix it?

Thanks
Jim Steed
3-5-2014
 
Heather   Heather, Macomb, IL
Mar 10, 2014
Like Jim, I am looking for an updated version of this that works with Google's updated map site. Any help would be greatly appreciated.
 
Jeremy Upton   Jeremy Upton, Memphis, TN
Mar 10, 2014
I am still using this latest version in my own solutions without issue. I am using windows. Perhaps there is a difference in the way Mac OS (Safari) is handling it? Can someone using Mac OS shed light on this?
 
Heather   Heather, Macomb, IL
Mar 11, 2014
Jeremy - good to hear from you. Thank you so much for this function! It's been great for sending a map link to our workshop participants in their confirmation email. The error I am getting with it now, however, is a Google error 500 - "the server encountered an error and could not complete your request." I do use Mac OS 10.8.5... and FileMaker 12.
 
TomW   TomW, Vancouver Island
Mar 20, 2014
I am having the same error 500 problem using Win7 and FMP12. It works on a few addresses, but not the majority.
 
Derek   Derek, Columbia, MD
Mar 20, 2014
I just ran into a similar issue in both FileMaker 12 0v3 and 13 0v1 in OSX 10.9.2 Mavericks. Except my error says, "The Google Maps Embed API must be used in an iframe."

If I remove the line, ["&output=embed&iwloc=0"] then it works like a normal google map portal (not zoomed).

Does this help narrow it down, or just confuse things more?
 
steve mcguirk   steve mcguirk, northville MI
Mar 21, 2014
the function has stopped today, message from Google in the iFrame

"The Google Maps Embed API must be used in an iframe."
 
TomW   TomW, Vancouver Island
Mar 23, 2014
I solved my intermittent problem, but now get the same error:
"The Google Maps Embed API must be used in an iframe."
 
Jeremy Upton   Jeremy Upton, Memphis, TN
Mar 24, 2014
I can confirm the latest error: "The Google Maps Embed API must be used in an iframe."

I do plan on revisiting this and hopefully getting a working function going. Unfortunately I am in the middle of another large development project that I cannot pull away from. I apologize if this leaves your solution without a working option. Keep an eye out though. I would imagine that someone will get a fix soon. Thanks all.
 
Josh Palmer   Josh Palmer, Philadelphia, PA
Mar 24, 2014
Change the last bit of the function to

&output=svembed&iwloc=0

It should work after that.
 
TomW   TomW, Vancouver Island
Mar 24, 2014
Thanks! That appears to work fine!
 
Jeremy Upton   Jeremy Upton, Memphis, TN
Mar 24, 2014
It looks like Josh's solution does make the function work. However, the result is no longer limited to displaying the map only, which is the point of the function. Otherwise, the navite Filemaker Google map option does the same thing.
 
Jimmy Madison   Jimmy Madison, Arley, Alabama
Mar 26, 2014
All of the solution that I have this CF in now has an error: "The Google Maps Embed API must be used in an iframe." Not sure whats going on. Has any one found a fix for this error. It was working fine. Thanks for your creation of this CF Jeremy.
 
MikeD   MikeD, Paris
Mar 31, 2014
"&output=svembed&iwloc=0" works fine on FileMaker Pro but not on FileMaker Go.
Any idea ?
 
Josh Palmer   Josh Palmer, Philadelphia, PA
Mar 31, 2014
I use the following in my solution. It works in both pro and go.
Allow interaction with web viewer content and Automatically encode URL both checked.

"http://maps.google.com/maps?q=" & Contracts::ProStAddress & "," & Contracts::ProCity & "," & Contracts::ProState & "," & Contracts::ProZip & "&z=" & 15 & "&output=svembed&iwloc=0"
 
Ed Langham   Ed Langham, Bloomington, IN
Apr 3, 2014
Josh. Excellent. This works great. Thank you!
 
Brian Iredale   Brian Iredale, Calgary
Apr 11, 2014
Finally an answer to the iframe problem!

Thanks..
 
Hideki Oshiro   Hideki Oshiro, Ginowan Okinawa
Apr 15, 2014
Excellent! It was great works. Appreciated.
 
Jeremy Upton   Jeremy Upton, Memphis, TN
Apr 15, 2014
Good find, Josh. Thanks for the help. The function has been updated to the working version.
 
Will Loving   Will Loving, Dedication Technologies, Inc.
Apr 23, 2014
Does anyone know how to add the code which will place a marker at the address location on the map? The CF works fine at displaying the map with the location centered but it would be nice if it could include a named marker as well. Any insights?
 
shuyou   shuyou, Calgary
Apr 25, 2014
help me so much
 
Derek   Derek, Columbia, MD
Apr 27, 2014
Brilliant! I just updated with "svembed" and it made all the difference. Thanks!
 
Steve M   Steve M, Broomall, PA
Apr 30, 2014
@ Will Loving. You may want to check out this. You can put one pin or multiple pins on a map.
https://fmdev.filemaker.com/docs/DOC-3321
 
Alain   Alain, Blankenberge-Belgium
May 6, 2014
changed "embed" into "svembed" ... did the trick

Thanks!
 
Alastair   Alastair, Knutsford, UK
Jun 6, 2014
Spent best part of an hour signing up to get Google Map API and how to use it with web viewer. Stumbled on this and in seconds it works perfectly.

Brilliant, thanks.
 
Mike T   Mike T, Adelaide Australia
Jul 19, 2014
Great thanks, I had used your previous function and wondered why it recently broke, then noticed the "s" and added this in front of 'vembed' and all good again.

Thanks so much
 
Greg   Greg
Dec 13, 2014
Thank you for this post!

However, I am getting a giant message on my map, "Your browser's current font size is not supported. Please reset to the standard font size."

It only shows on my desktop computer. No problems in Filemaker Go.

Does anyone know how to get around this?

Thank you!
 
Shaun   Shaun , Inventor, Entrepreneur and Visionary
Jan 20, 2015
I believe this issue has returned. Receiving "The Google Maps Embed API must be used in an iframe." Hopefully someone smarter than me figures this out. - Thanks in advance!
 
bz   bz, Richmond, VA
Jan 20, 2015
"The Google Maps Embed API must be used in an iframe" issue reappeared for me too as of today.
 
Ted   Ted, Oswego, NY
Jan 20, 2015
Same problem. 'The Google Maps Embed API must be used in an iframe.'
Anyone have any ideas?
 
bz   bz, Richmond, VA
Jan 21, 2015
Found a solution. I modified the function with the code in this comment by Cowan http://forums.filemaker.com/posts/2722a9fcf2?commentId=283457#283457

I also deleted the zoom function parameter from the function since the zoom is already hard-coded into the code in the link above.

I also no longer get the annoying warning about the unsupported font size (OS X issue only).

The old function relied on google maps classic (tile-based) and this looks like the new vector-based google maps. The new one is slower when zooming in and out :-(
 
Will Loving   Will Loving, Dedication Technologies, Inc.
Jan 21, 2015
I found the key to the answer in another comment by "menno" in the thread noted above (http://forums.filemaker.com/posts/2722a9fcf2?commentId=288753#288753 ). Menno provided a custom function which I revised to work without an API key. This creates a string that includes the required iFrame.

GoogleAddress_iFrame ( webViewName ; street ; city ; state ; zip ; country )

Let ( [
address = Substitute (
TrimAll ( street & " " & city & " " & state & " " & zip & " " & country ; 1 ; 1 ) ;
[ ¶ ; "" ] ;
[ "ä" ; "a" ] ;
[ "ë" ; "e" ] ;
[ "ï" ; "i" ] ;
[ "ö" ; "o" ] ;
[ "ü" ; "u" ] ;
[ "ÿ" ; "y" ] ;
[ "Ã¥" ; "a" ] ;
[ "á" ; "a" ] ;
[ "é" ; "e" ] ;
[ "í" ; "i" ] ;
[ "ó" ; "o" ] ;
[ "ú" ; "u" ] ;
[ "ø" ; "o" ] ;
[ "ß" ; "ss" ] ;
[ "ñ" ; "n" ] ;
[ " " ; "+" ] ) ;
data = "data:text/html," &
"<!DOCTYPE HTML><html><body><iframe
width=\"" & GetLayoutObjectAttribute ( webViewerName ; "width" ) - 25 & "\"
height=\"" & GetLayoutObjectAttribute ( webViewerName ; "height" ) - 25 & "\"
frameborder=\"0\" style=\"border:0\"
src=\"http://local.google.com/
 
Will Loving   Will Loving, Dedication Technologies, Inc.
Jan 22, 2015
I've just uploaded a new function called "GoogleMap_Static" which creates a non-interactive map with Marker using Google's Static Maps API. Because the map is non-interactive it contains no Javascript, has no iframe requirement, loads faster and works in Preview Mode and in saved PDFs. It also has none of the clickable labels, links and zoom controls so it's very clean.

If you need an interactive map you'll need to look elsewhere but if a clean static map with a marker showing a location is all you need, check it out.

http://www.briandunning.com/cf/1732
 
Josh Palmer   Josh Palmer, Philadelphia
Jan 28, 2015
Google now requires an api key for static maps. free and available at https://developers.google.com/maps/
simply replace "API_Key" with your own

"data:text/html,<iframe
width=\"650\"
height=\"450\"
frameborder=\"0\" style=\"border:0\"
src=\"https://www.google.com/maps/embed/v1/place?key=API_Key
&q=" & Contracts::Address & "," & Contracts::City & "," & Contracts::State & "," & Contracts::Zip & "\">
</iframe>"

Hope that help.
 
JERRY   JERRY
Feb 6, 2015
This formula works in filemaker to bring up google map in a browser

it was posted at http://forums.filemaker.com/posts/2722a9fcf2?commentId=283457#283457

"http://local.google.com/maps?" & "q=" & Client::Client_Address1 & "," & Client::Client_City & "," & Client::Client_State & "," & Client::Client_Zip & "," & "US"

Is there a way to put a zoom level into this formula?
 
JERRY   JERRY
Feb 6, 2015
This formula works in filemaker to bring up google map in a browser

it was posted at http://forums.filemaker.com/posts/2722a9fcf2?commentId=283457#283457

http://local.google.com/maps?" & "q=" & Client::Client_Address1 & "," & Client::Client_City & "," & Client::Client_State & "," & Client::Client_Zip & "," & "US"

Is there a way to put a zoom level into this formula?
 
Zorba   Zorba, Richland, Wa
Feb 17, 2015
Saw this on another site:

Try changing:

&output=svembed&iwloc=0

to:

&output=svembedmfe&iwloc=0
 
Jeremy Upton   Jeremy Upton, Memphis, TN
Feb 18, 2015
I can confirm that adding "mfe" works in my solutions.

change your function to use "output=svembedmfe&iwloc=0"
 
Mark Ware   Mark Ware, Dallas, Texas
May 23, 2015
I am just now seeing that the google map is not supported correctly in FMPro13, so I have read through this thread. Seems Josh Palmer from Philly cited the following guidance:

Google now requires an api key for static maps. free and available at https://developers.google.com/maps/
simply replace "API_Key" with your own

Where on the Google site does one apply for/obtain the API Key so I can use Josh's solution to display the Google map within Filemaker?

Any guidance greatly appreciated.

Mark Ware
Dallas
mark@markstephenware.com
 
Jeremy Upton   Jeremy Upton, Memphis, TN
May 26, 2015
Mark,
I don't immediately know the answer to your question regarding Google API, however I can tell you that this custom function does currently work for displaying single locations on a Google map within Filemaker. If you are using an old version of the function you will want to update it to latest version that I put out in February. If all you are needing is a basic static map you shouldn't need an API key.
 
Dennis   Dennis, JC Raulston Arboretum
May 29, 2015
All I get with this custom function is a gray rectangle, with or without the "mfe" appended text
 
Dennis   Dennis, JC Raulston Arboretum
May 29, 2015
It doesn't fix the iframe error message
 
Fergus Pearson   Fergus Pearson, Whitehaven, UK
Jun 1, 2015
I'm in the same position as Dennis. I put in the new function, and it worked a few weeks ago, but now, again, I get the "The Google Maps Embed API must be used in an iframe" message. I've checked the function as best I can and I can't see what I'm doing wrong.
 
Jeremy Upton   Jeremy Upton, Memphis, TN
Jun 1, 2015
So, it looks like Google has made some changes again. The community has been pretty good about finding fixes (if there is one) in the past. Check back here, hopefully there will be a solution soon.
 
Matt   Matt, Houston, TX
Jun 2, 2015
i concur, the change doesn't fix the iframe issue.
 
Arjen van der Ree   Arjen van der Ree, Amsterdam
Jun 3, 2015
Bam, I have spent 2 days trying to get either the embedded maps API to work without that annoying box (not really embedded) or the Javascript V3 maps API to do a simple point on a map. The javascript solution tends to get very complex fast..
Apart from something that works on a regular loose page that ceases to work in the web viewer-object I have not found anything that works elegantly in a simple setup.
 
Tim   Tim, JEAMA
Jun 18, 2015
This fixes the iframe issue in Filemaker 13 for me. Notice the double quotes are changed slightly.

"&output=svembedmfe" & "iwloc=0"
 
Fergus Pearson   Fergus Pearson, Whitehaven, UK
Jul 9, 2015
Thanks Tim - I've come back to this and found your answer. This brings up a map, which is great - but it has all the frames with the photos and adverts. I'm too much of an amateur to know how to get rid of these. Can you help?
 
Carol   Carol, San Rafael
May 16, 2016
Still not working. Has there been another change?
 
Mark Bartley   Mark Bartley, Northants, UK
Oct 11, 2016
I keep getting the google maps overlay (directions etc) on top of the map, and a "sign in" box.

Not exactly what I was looking for. Any ideas?
 
unix   unix, Japan
Dec 25, 2016
It is the message from Google "The Google Maps Embed API must be used in an iframe."
 
Michael Leiser   Michael Leiser, BYA
May 30, 2023
I get this error
Wepage cannot be found??
 
Michael Leiser   Michael Leiser, BYA
May 30, 2023
Okay. I changed it, was missing quote. Anyway, now I get the error I get with google map function which is because I need an API. Do I? If yes, if I got one where would I put it. I'm unfami8liar with that. Thanks
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: