Steve Trefethen has been playing with Google Maps scripted by a Delphi VCL client application hosting Internet Explorer using a TWebBrowser control, and blogged on Mashup of Google Maps and VCL and Using Google Maps from a Windows Client Application. Allen Bauer added to the topic a long and detailed post on Adding Active Scripting to your Delphi Win32 application and a second one on Connecting an event to a Active Script function. In short, you can run JavaScript from your Delphi application, and hook it not only to Internet Explorer pages, but to the VCL in general.

Beside using a Google Map inside a Delphi application, you can write a custom server hosting maps, providing dynamic data to it. This is what I did last year and repeated (with a nicer demo) this year at the Delphi Day event in Italy. In short, you can have a Delphi application with an IdHttpServer component in it to serve maps and map data (like some XML with locations). Now you can see the data in browser or even host TWebBrowser in the application. The goal? You can have a ClientDataSet in the grid, edit data, and see in the map!

You can see a screen shot from the demo program below:

While I cannot post all of the code here, what is relevant is the OnCommandGet event handler of the HTTP server component:

procedure TFormMap.IdHTTPServer1CommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
fs: tFileStream;
begin
  Caption := ARequestInfo.Document;
  if (ARequestInfo.Document = '/map.htm') then
  begin
    fs := tFileStream.Create ('delphidev.html', fmOpenRead);
    AResponseInfo.ContentStream := fs;
    AResponseInfo.WriteContent;
  end
  else if (ARequestInfo.Document = '/map.xml') then
  begin
    AResponseInfo.ContentText := XmlFromCds;
  end;

The map.htm is a local file with the HTML of the map and the javascript used to populate it, getting data from map.xml on the same server. This request is turned to a custom method that grabs the related data from a ClientDataSet. Now this CDS is populated using Google's own GeoCoding, via HTTP (this time, the client component). For each city in the list box above, it does:

     strResponse := IdHTTP1.Get( TIDUri.UrlEncode(
          'http://maps.google.com/maps/geo?q=' +
          (sListCity.Names[I]) + ', Italy&output=csv&key=******'));
      sList.LineBreak := ',';
      sList.Text := strResponse;
      str1 := sList[2];
      str2 := sList[3];
      cdsTown.AppendRecord([sListCity.Names[I],
        StrToFloat (str1), StrToFloat (str2),
        Length (sListCity.ValueFromIndex[I])]);

It uses Google CVS output format and a StringList with a comma as separator to get longitude and latitude (I'm omitted Google my dev key, of course). If you set the local server port to, say, 8080, you'll be able to navigate to the address:

  WebBrowser1.Navigate('http://127.0.0.1:8088/map.htm');

Now where is the real trick? For any Google maps application to work you need to register the domain. I've registered 127.0.0.1:8088 with my dev key... and it does work! Maybe this is a hack Google will disable, but this has been working for over one year. Now let me know about your mashups, with Delphi clients and servers... or the two combined!