Google Maps for Silverlight

Tags: Google Maps, Silverlight

The title is not exactly correct if you had expected the cool DeepZoom maps with Google's imagery. Now you know :-)

What I am talking is a Silverlight control to display map images from Google's Static Map API. This means that you can display map imagery in your Silverlight application, and because it's Silverlight, you can use it in your list boxes or whereever you want.

The StaticMap control supports all the features of the Static Map API v2, which means you can display overlays and many different image types. You can define all the properties directly in XAML or you can bind them to other values in your application.

So if you don't need all the flash of DeepZoom maps, but need to display some geographic data, then this is what you are looking for.

XAML

<UserControl x:Class="TestApp.MainPage"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:map="clr-namespace:Reimers.Silverlight.GoogleMap;assembly=Reimers.Silverlight"
			 xmlns:ve="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
	<map:StaticMap Coordinates="51.477,0"
				   Width="400"
				   Height="400"
				   Zoom="10"
				   GoogleKey="Your Google Key"
				   MapType="Satellite">
		<map:StaticMap.Overlays>
			<map:StaticMarker MarkerColor="Yellow"
							  MarkerSize="Mid"
							  Point="51.477,0" />
			<map:StaticMarker MarkerColor="Brown"
							  MarkerSize="Mid"
							  Point="51.577,0.1" />
			<map:StaticPolyline LineColor="Green"
								Width="5">
				<map:StaticPolyline.Points>
					<ve:Location Latitude="51.477"
								 Longitude="0" />
					<ve:Location Latitude="51.577"
								 Longitude="0.1" />
				</map:StaticPolyline.Points>
			</map:StaticPolyline>
		</map:StaticMap.Overlays>
	</map:StaticMap>
</UserControl>

Currently it is available in the SVN trunk, but it will be included in the next release of the Reimers.Silverlight assembly.

Latest Tweets