Using Google Maps

Use this board to ask questions or have discussions with other Genie users.
Post Reply
Wayne C.
Experienced User
Posts: 139
Joined: Mon Aug 16, 2010 12:04 pm
First Name: Wayne
Last Name: Colasinski
Company Name: Sofworx / Tantara Transport
Contact:

Using Google Maps

Post 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?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Using Google Maps

Post 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?
Wayne C.
Experienced User
Posts: 139
Joined: Mon Aug 16, 2010 12:04 pm
First Name: Wayne
Last Name: Colasinski
Company Name: Sofworx / Tantara Transport
Contact:

Re: Using Google Maps

Post 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.
Wayne C.
Experienced User
Posts: 139
Joined: Mon Aug 16, 2010 12:04 pm
First Name: Wayne
Last Name: Colasinski
Company Name: Sofworx / Tantara Transport
Contact:

Re: Using Google Maps

Post 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?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Using Google Maps

Post 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 2646 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 2646 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?
Attachments
geniemapd.dspf.txt
DDS for green-screen display file
(1.42 KiB) Downloaded 442 times
geniemapr.rpgle.txt
RPG code
(515 Bytes) Downloaded 244 times
edshaw42
New User
Posts: 7
Joined: Mon Aug 06, 2018 4:42 pm
First Name: Ethan
Last Name: Shaw
Company Name: AE
City: COOKEVILLE
State / Province: Tennessee
Country: United States
Contact:

Re: Using Google Maps

Post by edshaw42 »

Does anyone have examples of the "directions" embeded api?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest