Page 1 of 1

Using Google Maps

Posted: Tue Sep 01, 2015 6:28 pm
by Wayne C.
Is there an easy way to pass an address to google maps from Genie? Having a problem using an iframe. Works for some websites but not google. Just need a small map of customer's location. While playing around I was able to use the html container widget and plugged in a hardcoded html statement I found from the internet and was able to get a functioning map using longitude and latitude. Is there something that is fairly easy to use to pass a street address to google maps?

Re: Using Google Maps

Posted: Wed Sep 02, 2015 9:57 am
by Scott Klement
I've had success using an iframe for this. It's important to include "output=embed" when you do so, however.

For example, your iframe's "iframe url" property might have a value like:

Code: Select all

script: "http://maps.google.com/maps?hl=enl&q=" + encodeURIComponent(get("D_15_5")) + " " + encodeURIComponent(get("D_16_5")) + " " + encodeURIComponent(get("D_17_5")) + "&output=embed"
(change the D_15_5, D_16_5, D_17_5 part to the approprate Ids for your screen)

Does that work for you?

Re: Using Google Maps

Posted: Wed Sep 02, 2015 3:18 pm
by Wayne C.
Thanks Scott, that worked beautifully. I was pulling my hair out last night trying to find something on the internet that worked and was relatively simple. Thanks again.

Re: Using Google Maps

Posted: Fri Sep 04, 2015 1:35 pm
by Wayne C.
The great part of this particular code is simple, clean, and works for latitude/longitude and addresses. I also tried using the name of a location (a convention center) when I didn't have a street address and it works for that too!

Also, I can only get the google map and iframe thing working when I'm using Firefox. For some reason it doesn't work with Internet Explorer (version 11). Any ideas?

Re: Using Google Maps

Posted: Fri Sep 04, 2015 3:51 pm
by Scott Klement
It works fine in Internet Explorer 11 for me. (I also tested it in Firefox, Chrome, Safari and Opera... works the same everywhere.)

To help you out, I hacked the screen out of the application I was testing with so it can be run by itself. I'll attach the RPG and DDS to this message so you can run the same screen on your system.

The screen looks like this in IBM i Access Client Solutions:
9-4-2015 2-45-19 PM.png
9-4-2015 2-45-19 PM.png (47.14 KiB) Viewed 2647 times
In Genie, I marked the 'PNR047S1' (upper-right corner) as the identifer. I dragged in an iframe, and set the "iframe URL" to the code I gave you earlier.
9-4-2015 2-47-09 PM.png
9-4-2015 2-47-09 PM.png (38.17 KiB) Viewed 2647 times
Again, I tested in IE11, Firefox, Chrome, Safari and Opera, all worked fine. I didn't try it in any older versions of IE, but I don't have any reason to suspect it wouldn't work. Maybe I should try an older version?

Re: Using Google Maps

Posted: Tue Aug 07, 2018 11:27 am
by edshaw42
Does anyone have examples of the "directions" embeded api?