Update: Joseph linked me to this Windows example by Mike Taulty. Very cool!

Over the past twelve months or so there have been impressive entrants into the online mapping space including World Wind, Google Maps, Google Earth and MSN Virtual Earth. Both World Wind and Google Earth are client-based applications which provide a fantastically rich user experience in a 3D environment whereas Google Maps and MSN Virtual Earth provide flat world view maps and allow you to pan and zoom into objects of interest. All products incorporate satellite imagery of varying degrees of detail.

All of these applications have captured my imagination and I’ve wanted to find a project that could integrate this type of information in some kind data visualisation. A few weeks ago I went digging through the World Wind source code to figure out if there was anything I could learn (I couldn’t host it externally, but I did get a deeper understanding of the approach that was taken in its architecture).

I also took a look at Virtual Earth tonight and with the help of Dr. Neil’s excellent viavirtualearth.com site I was able to quickly integrate Virtual Earth into a Windows application.

All I needed to do was drag on a Microsoft Web Browser control and point it at my local copy of the HTML file (samples ripped from viavirtualearth.com). Then I used the MSHTML COM API to drive the JavaScript embedded in the page from .NET code (complete sample available at Project Distributor).

  1 // Scrolls left on the map.
  2 IHTMLDocument doc = (IHTMLDocument)this.axWebBrowser1.Document;
  3 IHTMLWindow2 window = (IHTMLWindow2)doc.Script;
  4 window.execScript("map.ContinuousPan(-10, 0, 20);", "JavaScript");

Actually, now that I think about it, if I had done it in VB.NET I may have been able to just call the methods directly without having to use execScript because of its late binding capabilities (when you look up the MethodInfo’s for a COM object using reflection embedded JavaScript shows up as methods – its quite cute actually.