Hi Christof I would very much appreciate the full sample code. Many thanks.
In the meantime I have come up with this which works well enough Lparameters tcPostCode Local lcPostcode, lcHTML1, lcHTML2, lcHTML3, lcHTML, lcFile Thisform.Caption = tcPostcode lcPostcode = Strtran(tcPostcode, " ", "+") lcHTML1 = [<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?q=] lcHTML2 = [&hnear=] lcHTML3 = [,+United+Kingdom&z=14&iwloc=&output=embed"></iframe><br />] lcHTML = lcHTML1 + lcPostcode + lcHTML2 + lcPostcode + lcHTML3 = StrToFile(lcHTML, "C:\test.html") cURL = "file:///C:/test.html" Thisform.olecontrol1.Navigate2(cURL) Paul Newton -----Original Message----- From: ProfoxTech [mailto:[email protected]] On Behalf Of Christof Wollenhaupt Sent: 29 November 2012 16:42 To: [email protected] Subject: Re: Display a Google map on a form The following code uses the Google API to retrieve a map as a picture and display it on a form in a VFP image control named map. This code is from a method and uses a few helper classes. As Dave mentioned, the Google Maps API has a EULA that you would need to review. I can send you the full sample code, if you want. *======================================================================================== * Retrieve and display map *======================================================================================== *-------------------------------------------------------------------------------------- * Create helper objects *-------------------------------------------------------------------------------------- Local loHttp, loEncode loHttp = NewObject("cHttpClient", "cHttpClient.prg") loEncode = NewObject("cHttpEncoding", "cHttpClient.prg") *-------------------------------------------------------------------------------------- * Assemble Url. *-------------------------------------------------------------------------------------- Local lcUrl, lcWhat lcWhat = Alltrim(This.Value) If Empty(m.lcWhat) Return EndIf lcUrl = "http://maps.googleapis.com/maps/api/staticmap" ; +"?center="+loEncode.UrlEncode(m.lcWhat) ; +"&zoom=14" ; +"&size="+Transform(Thisform.map.Width) ; +"x"+Transform(Thisform.map.Height) ; +"&maptype=roadmap" ; +"&sensor=false" *-------------------------------------------------------------------------------------- * Retrieve and assign image *-------------------------------------------------------------------------------------- Local lcImg If m.loHttp.Connect("maps.googleapis.com") lcImg = loHttp.Get(m.lcUrl) Thisform.lblCode.Caption = m.loHttp.cStatusCode If not Empty(m.lcImg) and not IsNull(m.lcImg) Thisform.map.PictureVal = m.lcImg EndIf EndIf This.Value = "" Christof --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

