Using Google Maps
-
- 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
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?
-
- 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
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:
(change the D_15_5, D_16_5, D_17_5 part to the approprate Ids for your screen)
Does that work for you?
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"
Does that work for you?
-
- 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
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.
-
- 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
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?
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?
-
- 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
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: 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. 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?
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: 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. 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 440 times
-
- geniemapr.rpgle.txt
- RPG code
- (515 Bytes) Downloaded 243 times
-
- 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
Does anyone have examples of the "directions" embeded api?
Who is online
Users browsing this forum: No registered users and 2 guests