13 Replies Latest reply on May 1, 2014 4:01 PM by philmodjunk

    Google Maps custom web viewer

    braxton

      Title

      Google Maps custom web viewer

      Post

           For years I have had a custom setup to see a small Google map in my database.  Today it has disappeared and is just a gray screen.  It's probably because Google has been updating their maps.  The regular setup through the web viewer works.  But, you don't get a view of exactly what you want.  My setup showed me the location in a small box without any other information.  I'm going to miss this.

           The code I was using is:

           "data:text/html,<style type='text/css'>html,body{overflow:hidden;}</style><html><head><title>NavText</title><head><bodybgcolor='#FFFFFF'TopMargin='10'style='border:0'><iframe width='"&GetLayoutObjectAttribute ("web";"width")-18&"'height='"&GetLayoutObjectAttribute("web";"height")-18&"'frameborder='0' scrolling='no'marginheight='0'marginwidth='0'src='http://local.google.com/maps?q="&Client::Client_Address1&"+"&Client::Client_City&"+"&Client::Client_State&"+"&Client::Client_Zip&"&amp;output=embed&iwloc=0&z=13'></iframe></body></html>"

           Does anyone have a fix for what Google is doing now?

           Thanks.

        • 1. Re: Google Maps custom web viewer
          braxton

               Looks like some others are on to this, too:  https://www.briandunning.com/cf/1085

          • 2. Re: Google Maps custom web viewer
            Cowan

                 Google now requires users to use the Maps API, though there's a workaround I haven't tried detailed here: 

            https://www.filemaker-magazin.de/forum/alle-beitraege/138181

                 If you choose to go the API route, which I have, you have to register for an API key and use the key in your web address. The guide to embedding is here: https://developers.google.com/maps/documentation/embed/guide

                 Here's how my web frame URL now appears. I use decimal degrees for maps, but using addresses and so on follows the same principle. 

                 "data:text/html,
                 <style type='text/css'>
                 html,body {
                 overflow:hidden;
                 }
                 </style>
                 <html>
                  
                 <iframe
                   width='600'
                   height='300'
                   frameborder='0' style='border:0'
                   src='https://www.google.com/maps/embed/v1/place?key={API_KEY}&q=" & geolocations::decimalLatitude &" , "& geolocations::decimalLongitude & " &zoom=10
                   &maptype=satellite'
                  
                  
                 </iframe>
                 </html>"

                  

                  

            • 3. Re: Google Maps custom web viewer
              hoteljunky

                   Hi Cowan

                   I tried your code... but I still get a grey space instead of the map. I am using FM 13 on Maverick. Any idea what I have to do. Thanks for your help.

                   Regards from Switzerland

                   Patrick

              • 4. Re: Google Maps custom web viewer
                MarcMcCall

                     Try this 

                      

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

                • 5. Re: Google Maps custom web viewer
                  braxton

                       Thanks Cowan and Marc.  I'll get a API number and try this. 

                  • 6. Re: Google Maps custom web viewer
                    NathanJohnson

                         I'm having trouble implementing this fix for my script which plots lat/long for biological collections.  Here's the script that I have been using:

                         If [Count (tblField_Collections::N_Lat  ; tblField_Collections::W_Long )]

                            Open URL "http://maps.google.com/maps?q=" &  tblField_Collections::N_Lat & "," & tblField_Collections::W_Long & "&output=embed&iwloc=0"

                    End If

                         This script now returns the error, "The Google Maps Embed API must be used in an iframe."

                         I have registered for an API but not sure how to include it in the script.  I'm using FM pro 12 and have little experience with developing scripts (as you have probably figured out by now).  Any help is greatly appreciated.  Cheers, - Nate

                    • 7. Re: Google Maps custom web viewer
                      rustyt

                           Hi

                           I tried Cowan's suggestion but I too continued to get the grey box.

                           Has anyone managed to resolve this? I would be most appreciative of some help.

                           Regards

                           Russell

                      • 8. Re: Google Maps custom web viewer

                             I think that the problem lies somewhere between MacOS/Safari en Filemaker, because I run the almost identical code as Cowan has posted here before and that runs fine under Windows 7, 8 and 8.1, where a nice map with a route is displayed. Also I pasted the (generated) code in an HTML-file and when that's opened in Safari it shows the map that the webviewer should show instead of that gray area. 

                             I played around a bit with margins and changing double-quotes into single-quotes, but nothing seems to help. So any comments are appreciated

                             Regards, Menno

                        • 9. Re: Google Maps custom web viewer
                          WillLoving

                               The most recent revision of the Custom Function mentioned by Braxton ( https://www.briandunning.com/cf/1085 ) worked for me. The only issue I have is that under Mac OS X 10.8 the initial display of the map includes a warning that the browser's default font is not correct and you have to click "Dismiss" to clear the error message appearing at the top of the web viewer. Not sure if this is the same on Windows yet….

                          • 10. Re: Google Maps custom web viewer
                            bioplant
                                 Hi Nathan Johnson, I have the same problem with plant collection, I think the problem is related with the recent change in google maps.
                                  
                                 You must change the code like this:
                                  
                                 If [Count (tblField_Collections::N_Lat  ; tblField_Collections::W_Long )]
                                  
                                 Open URL "https://local.google.com/maps?q=" &  tblField_Collections::N_Lat & "," & tblField_Collections::W_Long & "&z=12&output=svembed&iwloc=0"
                                  
                                 End If
                            • 11. Re: Google Maps custom web viewer

                                   Hi xaluv,

                                   the problem also lies in a change in Filemaker, since up until version 12.0.4 on MacOSX the code to embed a google-map in a webviewer worked perfectly fine. After updating to 12.0.5 and also with any upgrade to 13.0.1 thru 3 the same code does not work anymore where it works just fine under any Windows  version (7, 8, 8.1, 2008R2) where FM runs on. I reported it as an issue: Webviewer shows grey area with googlemaps EmbedAPI on MacOSX elsewhere on this site.

                                   Basically the problem consists from 2 parts:
                                   1) google did make some changes, where they made it mandatory to use their API with an API-Key, when you wish to embed a map
                                   2) Filemaker on the Mac from version 12.0v5 and higher does not show maps in an i-frame (again it work fine under MS-Windows)

                                   I have prepared a file here where you can see a small demo on how-to use the official google-embed-api. You must enter a API-Key of your own in the file, but you'll find a (very) short explanation in the file on how-to do that.

                                   regards, Menno

                              • 12. Re: Google Maps custom web viewer
                                bioplant

                                     Hi menno, I see the problem, but in my case I have FM 12.0.5 and FM 13.0.3, and my problem is only with the use of latitude and longitude, like the case of Nathan Johnson, I was working two days looking for the solution, and the code that I post work in my case.

                                     However something strange is happening with the web viewer in FM 12 and FM 13, for example I use the next code to see a scientific database of names, it work in FM 12 but no in FM 13:

                                     "http://www.theplantlist.org/tpl1.1/search?q=" & Especies::Género & "+" & Especies::Especie

                                     This behavior is similar for other web site with databases, they work in FM 12 but not in FM 13.

                                     I think the problem that you say is for the reason that you mention, but in other case something change in the Web Viewer of FM 13, and it is a big problem, FM 13 has many bugs o chances that the company not indicate.

                                      

                                      

                                • 13. Re: Google Maps custom web viewer
                                  philmodjunk

                                       xaluv,

                                       I recommend that you post an issue report on this in the Report an Issue section.