Silverlight Google Map Control

Let us look at building a GIS Silverlight application with a map control. Silverlight enables this by the DeepZoom composer and MultiScaleTileSource class which can be used to host the map (ofcourse by creating another custom control).

Tile Map Service:

Tile Map Service is a specification by the Open Geo Spatial Consortium which states the basic rules that need to be implemented by the Map Servers so that the clients can access them seamlessly. Infact in this case we need some map controls using the above controls like MultiScaleTileSource to show the images served by the map servers’ using these Tile Map Services. There are a host of public map servers available in the internet like Yahoo Tile Map Service, OSM Tile Map, Blue Marble and more., All these services provide the maps as Tiles which are nothing but small chunks of the map images generated in the map server which are served asynchronously for our applications to display.

These can be used very easily to host the maps very easily using some third party map controls like DeepEarth which is opensource and a lot of other commercial providers. I faced some issues with DeepEarth, but we can discuss those in some other article. Infact we’ll need one dedicated and basic article of how to use the deepearth control for hosting a map in a silverlight application. In the meanwhile you can visit the above url to get some info if you need it urgently.

Indeed, at this point there are lot of Map providers who offer this Tile Map Service like Yahoo, OSM, Blue marble etc., But the catch here is that their data is not up-to-date enough.

Silverlight Map control for Google:

So this pushes us to the next web giant Google, who has better set of data but does not offer the maps using the Tile Map Service Specification. Neither google give direct support to silverlight by giving a control. The terms of google as on May 2010, simply state that any use of their API apart from the currently supported platforms like Javascript or Flash are against their license terms. So this puts us in a difficult situation and we have only one choice, which is to host the map using Html overlay.

We can use our existing Html host control. Infact Silverlight 4 offers a inbuilt control but unfortunately I am still stuck with Silverlight 3 due to several reasons. So let’s go ahead and use this control.

How this is built?

This project is just a plain basic silverlight application which hosts the FreeHtmlHost control. In addition to that this contains a GoogleMap.aspx file which hosts a Javascript Google Map. Now this can be directly used inside another silverlight project in a similar fashion to host a google map.

Sample Files for Google Silverlight Map Control:

Click here to download the sample project for the above.