Mashup of Google Maps and VCL


In light of Google Developer Day, which I’ll be attending tomorrow, I thought I’d be fun to post a teaser about a little VCL mashup I’ve been working on where I’ve created a descendant of TWebBrowser to render a Google map with two-way interaction between Javascript  and the VCL. The “trick”, at least in this case, is using IDocHostUIHandler.GetExternal and connecting the ppDispatch parameter to a Pascal object from the VCL application which exposes application functionality to the Javascript running in the browser control. The screenshot is a standard VCL TForm application with two TButton’s, one places a marker on the map at a particular longitude/latitude and the other pans the map to a specific lat/long. Once placed, clicking the marker causes the form’s caption to update with text passed from the original button click. The Pascal code is particularly interesting to me because the concepts are very similar to code developed for the Zombie Test Automation framework used back in D3 days. Similar code is used in the IDE’s welcome page to handle opening of projects from the browser control.

If there is interest I’ll look to blog about this in more detail so let me know what you think.

Have you done any interesting VCL/web mashups?

Nitpicker’s corner (with apologies to Raymond Chen for borrowing the name):
I understand this may not fit the classic definition of a “mashup” but it seemed fitting to me.

[UPDATE: April 2, 2008] Related links:

11 thoughts on “Mashup of Google Maps and VCL

  1. Hi Steve,
    That looks quite interesting. Really interesting indeed !!!!
    Could you be so kind to place the source online or mail me if there’s a privacy issue ?
    Cheers,
    Gustavo Carreno

  2. All,
    Sorry, I’ve been out of town for the last few and haven’t been able to respond. The code I’ve been working on isn’t ready for public consumption and I’m still playing with a few different approaches regarding VCL mashups. I would be interested in hearing from anyone who is or has tried something similar as it seems there could be some real value added. Of course, this concept isn’t unique to Delphi so even if you’ve done MFC or WinForms or something else I’d be interested.

  3. Hi Steve,
    Ok, you’re excused this time, but just because you’re a nice guy !!
    We’ll wait patiently for you to mature your code and make it public ready.
    Cheers,
    Gustavo Carreno

  4. Everybody is doing mashups with Google Map and Virtual Earth now. Pulling business data from enterprise database is more interesting and more lucrative than mapping your own house. Oracle has spatial data types (SDO), and if you could pull the data out of Oracle SDO and push them to Google Map and Virtual Earth, that would be more interesting.
    Regards,
    Bud

  5. My previous comment may sound arrogant, so please allow me to clarify a little.
    It would be cool to make your VCL database aware, allowing Lat, Lon fields to be set. Developers can worry about what back end database to use.
    Regards,
    Bud

  6. Hi, I’m working on a project in Brazil – Sailormade (www.sailormade.com.br). We built the front-end in Delphi, using TWebBrowser Component (http://www.cryer.co.uk/brian/delphi/twebbrowser/twebbrowser_properties.htm). This is a wrapper for the Internet Explorer installed on host computer.
    The integration with Google Maps is done by the use of Javascript and are only possible if there’s some kind of Internet connecton.
    Is there someone able to use bitmaps on cache when offline? I guess you have to cheat on Google… They already mentioned this is not possible.
    Like to hear from you guys any more info about this subject.
    []’s

  7. Hi Steve, can you send me the full source code of the Article, I read, understand the most of part, but I don’t understand how to create wrapper class.. can you give me the source..
    Thanks.

Comments are closed.