Skip to Content
Author's profile photo Former Member

Calling google maps from powerbuilder

A while back I was asked to allow my users to enter their patient address and then use the default address to generate google directions for them. With the help of the community here I was able to use the following code to create an instance of inet object:

inet li_net

GetContextService(“Internet”, li_net)

li_net.HyperlinkToURL( ls_URL )

I built the ls_URL from our default address that was basically like:

300 east long lake road, city name (with a space in it)

However when I passed this address (with spaces) to INet HperlinkToURL method google maps will not generate the correct directions. I found out that in order for right google directions to be generated using INet object HperLinkToURL method I must stuff all spaces in my address with ‘%20’ and only then a space will be treated as space by google webservice that returns the proper address. This was shared with the community via the forum discussion as well but since this was something I thought I can create a document for and make it permanent for other people to benefit. I hope this will help. 

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Bruce Armstrong
      Bruce Armstrong

      Yes, that is actually expected behaivor.  There are reserved characters (including spaces) that can't normally be used in a URL.  Some browsers (e.g., Internet Explorer) will do the encoding for you, but it's best to encode them in the URL directly.

      Author's profile photo Former Member
      Former Member

      Bruce: thank u so much for your comments, always contributing something. However I was using IE 9.0 but the browser did not automatically encode the spaces for me, I had to explicitly code them before passing it to inet.hyperlinktourl method. Once I did the explicit encoding everything worked fine.