Virtual Earth 6.1 was released recently and I thought I’d give the whole mapping thing a try.
VE has the best iSDK I’ve ever seen, period. It has the demo, source, reference all in synchronized tabs. Real slick!

For those of you who don’t know, Virtual Earth (VE) is a mapping platform by Microsoft, that comes with a map control and its kitchen-sink infrastructure.
Live Maps built on top of it is a competitor to Google Earth and I, personally, find it richer and easier to use.

Anyway, back to a quick app to get started…
Let’s start with a .NET C# website project and use default.aspx.

Jump into your aspx source and add:

<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1" />
</Scripts>
</asp:ScriptManager>

This basically adds a reference to the VE service.

Add a container element for the map:

<div id='myMap' style="position: relative; width: 800px; height: 800px;"> </div>

To actually show the map, we need to execute a couple of javascript lines on the Body load.
Either add an onload event handler in the body tag or (I recommend) add a .js file
and add

function pageLoad()
{
map = new VEMap("myMap");
map.LoadMap();
}

and add a reference to the js file in your HEAD tag or via the ScriptManager tag:

That’s all it takes to have the map show up on your page. Pretty cool, huh?

In the next posts, I’ll show you how to make your project setup more efficient and do some more stuff like finding/adding locations, etc.

Meanwhile, go check it out: http://dev.live.com/virtualearth/ and play with the iSDK: http://dev.live.com/virtualearth/sdk

Advertisements