Interactive Mapping Blog

Mapping Solutions News

Archive for the ‘Microsoft Virtual Earth’ Category

Bings Maps Launch Streetside, Enhanced Bird’s Eye and many more new features

Thursday, December 3rd, 2009

After months of biting their tongues, Bing have finally announced their latest additions to Bing Maps by releasing the beta version of Silverlight Bing Maps which features two new map modes (Streetside View and Enhanced Bird’s Eye) plus an Application Gallery and also Photosynth to name just a few.

The entire site is built in Silverlight (although the Bing Maps AJAX site is still available  if for some reason you don’t want to see the amazing new features). Features include:

Streetside: ground level, fully stitched together high res photographs giving a seamless 360 degree panorama.

Enhanced Bird’s Eye: In urban areas: Bing have used high resolution photography and stereo data to create 3D models of locations and placed them into the 2D interface of a webpage but with 3D aspect ratio from Silverlight 3. In non-urban areas: Bing have used their satellite imagery and aerial photos and re-projected the Earth to give a better perspective of the world.

Application Gallery: a catalogue of all the Bing Maps applications creating a simplified search and bookmarking function.

Photosynth: now fully integrated into the maps so you can fly in from space straight into your next door neighbours lounge(!) (but only if they have created a synth of course).

Simultaneous Multiple Searches: perform multiple searches within one map to discover all you can (tweets, blogs articles, local businesses, imagery etc)about a location without leaving the map.

Local Search Integration: Bing Local Search fully integrated into Bing Maps (the opposite has been available for a while).

Simplified Navigation: The navigation buttons have been moved to the bottom of the page and you can select Automatic (based on user feedback), Road, Aerial or Bird’s Eye or Streetside (our new friend ‘Blue Man’) views.

Integrated 1-Click Directions: if you know where you’re trying to get to, search for the location and select directions to get there approaching from the north, south, east or west.

Route Query Parsing: if you are planning to drive from, for example, Seattle to San Diego just enter “Seattle to San Diego” in the search box and get point to point driving directions.

Auto-Location Detection: when you load Bing Maps in Silverlight the site will automatically detect where you are located and centre the map to show your current position.

Weather: weather information has been embedded into the maps allowing you to view the latest weather conditions at your current location (using the auto-location detection) or for the location you are searching for.

Images: Bing Image Search has been integrated into Bing Maps giving you instant access to images of the location you are searching for.

Defined Regions Query Parsing: search for a neighbourhood within a city, for example, “San Diego Gaslamp,” and the map will centre on that neighbourhood and highlight the area on the map.

For a full list and description of the new features read Chris Pendleton’s blog or if you would rather watch a demo click here.

The Earthware team has been eagerly awaiting this latest offering from Bing Maps. The enhanced functionality is set to make displaying and searching for location based information much more simple. We know the Bing Maps team have been working very hard to develop this and we congratulate them on what they have achieved.

If you are interested in creating a map using Silverlight (or any other mapping API) to display your information then please drop us a line at info@earthware.co.uk.

Great Example of Using Overlays and Heat Maps in Microsoft Bing Maps

Thursday, October 22nd, 2009

At Earthware we are always on the lookout for Microsoft Bing Maps (formally Microsoft Virtual Earth) implementations that use mapping to display useful information in a really intuitive way.  We are especially keen to see overlays (or heat maps) being used in Bing Maps.
 
We came across a good example the other day that uses Bing Maps to plot crime statistics for the UK. Please take a look at http://maps.police.uk/.
 
Our view is that the interface is simple enough and we like the subtle use of a gun sight for showing you where the centre of the map is. If we had any suggestions it might be that the polygons can get a bit ropey at the lowest zoom levels and the use of shaded grey rather than two tones is not as visually differentiated as it could be. We might also suggest adding the ability to see crime statistics for neighbouring counties when you are close to a border.
 
However, great idea, nicely implemented – congratulations to those involved in the project.
 
As always, if you are reading this article and are interested in creating heat maps in any mapping API (Bing Maps, Silverlight, Google Maps, Multimap, MapPoint etc.) or just want to see how you could use interactive mapping to display your information then please drop me a line at neil@earthware.co.uk.

Bing Maps Silverlight control – top 10 wish list for release

Monday, June 22nd, 2009

UPDATED: As recommend by SoulSoltions in the comments I have marked each wish by whether it should be in the core control or in a separate toolkit (IMHO)

We have spent the last month working with the current Bing maps Silverlight CTP control (formally Virtual Earth) to create the new Bing Maps World Tour application which has been a really great experience. The current Silverlight control opens up a whole new world of possibilities when creating rich mapping solutions but as always we want MORE!

 

Here is our top 10 wish list for features and tweaks to be in the final map release in no particular order:

 

1.     Custom map view animations – include in core
Being able to quickly customise the speed and style of animation the map uses when navigating between map views would be great and allow developers and designers to add their own unique touch to their mapping projects.

 

2.     A basic pushpin & infobox control – include in toolkit


The Silverlight control team have deliberately left the creation of pushpins and popups to developers and designers as this gives us complete control and flexibility which is great and something missing from the current Ajax control. However, we can see some good reasons to have a basic pushpin and infobox offered by the final control release.

Firstly for new Silverlight developers coding a pushpin and infobox that works the same as the Ajax pushpin control is not a simple task so having a basic control they can style or build upon would allow people to get simple applications up and running faster.

Secondly for experienced developers being able to inherit from built-in controls will save a lot of repeated coding in different projects.

 

3.     Easy to style navigation controls – include in core
You can currently style the navigation controls, but getting access to this functionality is not straightforward (hopefully we will blog a tutorial on this soon). Being able to just apply a style or custom template as for normal Silverlight controls would be brilliant.

 

4.     Bird’s eye imagery – include in core


It goes without saying that Bird’s eye imagery is one of Bing maps greatest features, we hope it will make it into the first official release.

 

5.     Clustering – include in toolkit
Having a basic but extendable clustering solution would again help new and experienced developers quickly get applications online.

 

6.     Built in routing – include in toolkit
Although routing can currently be achieved quite simply using the examples from the interactive sdk, having this functionality built-in would save a lot of time and effort and again make it more open to new developers.

 

7.     Real time zoom level range data – include in core
The CTP release improves on the Ajax control by restricting zoom levels when the higher zoom levels are not available at a location. This is a great start but the data for this is not very detailed and you will still often get the dreaded camera icon appear.

Being able to get more detailed data, ideally in real time would be an excellent addition to the control ensuring we banish the camera icon forever! 

 

8.     Drawing controls – include in toolkit
Something that has often been requested for the ajax control is an officially supported set of drawing controls allowing polyline and polygon drawing as on bing.com. Having these available first in the Silverlight control would be great especially as it should be easier in Silverlight than it is in cross browser javascript. 

 

9.     KML / GeoRSS support – include in toolkit
The ability to quickly load a georss or kml file into the ajax control has been a massive help to new users and those of us wanting to quickly generate a map from existing content. Having this in the Silverlight control would encourage people to use the new control more as mashups would be quick to create.  

 

10.  Modular design
One issue with the ajax control has been that you need to download all the control code even if you don’t want to use all the features in your project. With the current Bing Maps Silverlight control dll coming in at 489kb it would be good to be able to optionally include features by having different dll’s for separate parts of the control. Another option would be to support assembly caching for the Silverlight map control similar to that in Silverlight 3 for the core framework dlls.

 

It was actually pretty difficult to come up with 10 sensible wishes as the current control has so many great features already. It would be great to see these all release but I have no doubt they are not all, if any, on the release list. Hopefully those that don’t make it might become part of the new direction that the codeplex project DeepEarth is taking, by creating a collection of reusable map controls in Silverlight.

 

We would love to hear comments about your own suggested features to see what the community as a whole want to see developed, so please add your comments below.

Earthware develops ‘Bing Maps World Tour’ for Microsoft

Monday, June 22nd, 2009

The Microsoft Bing Enterprise Mapping team approached Earthware two months ago, with an idea to communicate their monthly imagery releases to clients and partners in a more visually engaging format.

With each month’s imagery release potentially covering hundreds of updated locations worldwide the current system of publishing a simple list of all the locations was not demonstrating the full impact of each release. Microsoft was also keen to use their latest Bing Maps Silverlight control, to create a visually rich interactive mapping application which could be both a showcase for the monthly updates, and the possibilities that Silverlight and Bing maps can offer.

Microsoft were also keen to host the new application on the Windows Azure platform to show the flexibility of combining Azure services with the Bing Enterprise maps.

Windows Azure Development    Bing Maps     Microsoft Silverlight Development

Why Earthware?

Earthware already had extensive experience with Bing maps and the new Silverlight control after taking part in the closed beta program in early 2009. As part of this Earthware produced a Twitter map demo application which Microsoft demoed as part of the Bing Maps Silverlight control’s release publicity. The Twitter demo also used the Azure platform.

What did we deliver?

Bing Maps World Tour

  • A visually rich mapping application using Microsoft’s Bing Maps Silverlight Control and hosted on the Windows Azure platform.
     
  • A secure back office administration area to allow the Microsoft team to quickly, and easily, add and update monthly imagery release information.
     
  • A back end database built upon the Windows Azure table storage service.
     
  • The entire first release of the Bing Maps World Tour application was delivered in less than six weeks and in time for the challenging May 2009 imagery release deadline.
     

Try the finished Bing Maps World Tour application for yourself on the Bing Maps Website or read more about the application at the official Bing maps blog. You can also see the reaction of the developer community to the applications release on twitter.

If you are interested in Earthware helping you to create similar interactive animated mapping applications for your products please visit our interactive mapping consultancy page.

Add a bit of ‘Bing’ to your silverlight maps

Tuesday, June 2nd, 2009

As you cannot have missed in the news recently Microsoft has re-branded its search offering to be called “Bing”. This means Virtual Earth is now called Bing Maps for Enterprise.

Yesterday Microsoft automatically updated the Ajax Virtual Earth control to use the new Bing logo and you may have wondered why the Silverlight map control was not also updated? The reason is that the logo is a resource in the Silverlight control assembly and is not pointing to an external file.

So does that mean we have to wait for a new release of the Bing Silverlight map control before the logo will get changed? Well yes and no, if you want it to be automatically changed you will have to wait for the next release but there is nothing stopping you changing it yourself now by following the steps below.

Step 1 – Getting your project setup

If you don’t already have a Silverlight project setup with the Bing silverlight maps (Virtual Earth) control working see Chris Pietschmann’s excellent getting started tutorial.

Step 2 – Getting the new logo

You can download the new Bing logo from the url below:

http://www.bing.com/maps/i/logo_powered_by.png

Save this to a folder in your Silverlight project (for example Images) and then in Visual Studio ensure you include the new image in your Silverlight project and set it to be “Content” so that it gets included in the Silverlight xap file.

1

Step 3 – Hiding the existing logo

You may be asking how we turn off the existing logo? Well luckily the current Silverlight control allows us to hide the logo using the “LogoVisbility” attribute. You can do this in the XAML code as follows:

   1: <UserControl x:Class="BingLogoDemo.Page"
   2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
   3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   4:     xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
   5:     <Grid x:Name="LayoutRoot" Background="White">
   6:         <m:Map x:Name="mainmap" LogoVisibility="Collapsed">
   7:             
   8:         </m:Map>
   9:     </Grid>
  10: </UserControl>

 

Step 4 – Adding the new logo

Now we need to add the new Bing logo. This is done by adding an image control and setting its “Source” attribute to point to the new logo file we downloaded in step 2. With a little alignment and margins we can get the logo to be in the same position as the original one. Below is the XAML showing you how to do this.

   1: <UserControl x:Class="BingLogoDemo.Page"
   2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
   3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   4:     xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
   5:     <Grid x:Name="LayoutRoot" Background="White">
   6:         <m:Map x:Name="mainmap" LogoVisibility="Collapsed">
   7:             
   8:         </m:Map>
   9:         <Image Source="/Images/logo_powered_by.png" Width="93" Height="29" Margin="7 0 0 25" VerticalAlignment="Bottom" HorizontalAlignment="Left"  />
  10:     </Grid>
  11: </UserControl>

 

2

That’s it your all done.

Summary

Hopefully this tutorial has shown you just how easy this is to update. We could of course have used the online image file as the source of the image control, rather than including the new file in our application, but that might cause issues in future if Microsoft change the name of the file, or resize it. You can download a sample project showing the new logo below:

Microsoft Announces Photosynth Commercial Terms

Wednesday, May 20th, 2009

Having released Photosynth for commercial use Microsoft  have now announced their commercial terms making it clear how this technology can be used.

Using Photosynth

As long as the synths embedded in a website comply with the terms of use, are publicly available and use under 20GB of storage they are free. If you want to make your synths private (not listed on the photosynth website) you can ‘unlist’ them but this comes with some restrictions. Unlisted synths are limited to 1GB of storage (it is 20GB for public synths) and synth views (when a view opens a synth) are limited to 500 per month. If the way you use photosynth exceeds or is likely to exceed these limits you will need a photosynth commercial license.

Benefits of a commercial License

  • All the benefits of unlisted synths (not listed on the photosynth website or indexed by search engines)
  • Unlimited synth storage
  • Unlimited synth views

Synth views are counted as Microsoft Virtual Earth billable transactions. Microsoft track how many synth views are used and charge accordingly.

Photosynth has many applications in the commercial market. For example, Earthware client London Property specialists Residential Land are using it in the Virtual Earth property maps to give internal tours of their available properties.

Happy synthing!

Microsoft makes Photosynth commercial and Earthware adds property Photosynths in Virtual Earth maps to London property website

Thursday, May 7th, 2009

Microsoft has just announced the release of the latest updates to their Photosynth technology, which through an integration with Microsoft Virtual Earth means that the technology can now be used commercially.

What is Photosynth?

Photosynth ‘stitches’ together digital photos of any object or location giving the user a 3D, 360-degree, interactive experience of the space. You can navigate around the ‘synth’ to view the object or location from all angles (according to the number and position of the original photos) and zoom in to the images to see the detail.

What has been added to Photosynth?

The latest release of Photosynth introduces:

· Commercial licensing – businesses can now use the technology to give their customers an exciting new way to explore and interact with their products, whether that be a hotel room or a car

· Privacy controls – users can now choose how they share the synths by making them public or unlisted on http://www.photosynth.net

· One click highlighting – makes navigating through the synths much easier

What have Earthware been doing with Photosynth?

At Earthware we have been playing with photosynth for a while now, and with Microsoft’s latest updates we have now made live our new property photosynths map using Virtual Earth in London property consultants Residential Land displaying three of their properties using this new technology.

Residential Land Photosynth Map

Residential Land users are used to seeing the great Aerial and Birds Eye imagery of property that is available with the Earthware Property interactive maps already available on the site, but now with the Photosynth map they can also see the inside of the properties. They can ‘walk’ around the space to discover how the rooms flow together and even zoom in to see what the cupboard door handles in the kitchen are like. Buyers/renters are able to see the property inside and out without actually needing to go there, opening up more properties to them and therefore increasing Residential Lands rental and sales figures.

View the photosynth map to see exactly how Residential Land are using photosynth and contact Earthware to find out how you could be using it too.

Get yourself / your logo on Microsoft Virtual Earth Aerial Imagery tomorrow morning in the UK!

Tuesday, March 31st, 2009

UPDATED: If you hadn’t realised already its APRIL FOOLS today! But seriously if you are interested in getting your own real, or photo-shopped (like our demo), imagery added on top of virtual earth just for your website please contact us for details.

We have found out from our sources at Microsoft UK that tomorrow between 9-12am you can get yourself, or your company logo snapped on the aerial imagery for 10 major UK cities! If you can get a logo for your company displayed in a car park or on a rooftop you can get free advertising for your brand, or even better still get the whole company out in the car park and all look up.

Here is our offices from last year when we also received flight plan information in advance:

We will know more detail about the exact flight plans early tomorrow morning for the following cities:

  • London
  • Manchester
  • Liverpool
  • Cardiff
  • Birmingham
  • Bristol
  • Norwich
  • Leeds
  • Coventry
  • Reading (no surprise Microsoft UK are based here!)

If you want to find out exactly when they will be flying over you please email us for details. Microsoft have done similar campaigns before in Austria Australia called “look up and smile” for 2006’s Australia Day.

The images should be added to Virtual Earth within the next 2 months, if you would like to add a map similar to ours above when you imagery becomes available please contact us.

Virtual Earth Silverlight Minimap Tutorial

Saturday, March 21st, 2009

In this tutorial I’m going to show you how to create a simple styled minimap to use in your Virtual Earth Silverlight projects that looks exactly like the one we used in our Twittermap demo.

As those of you who have already tried the CTP control there is a lot of things we take for granted with the javascript control that required some work to achieve in Silverlight, the minimap is one of these but thankfully its really easy to create your own.

Getting Started

Assuming you already have your Silverlight development environment setup and have installed the Virtual Earth Silverlight CTP then start by creating a new Silverlight project, or use your existing project. First you need to add a reference to the Virtual Earth Silverlight control to your Silverlight project:

addingveslreference

Then add a simple Virtual Earth map control to your page.xaml as follows:

<UserControl x:Class="MinimapDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
    <Grid x:Name="LayoutRoot" Background="White">
        <m:Map Name="mymap" Mode="AerialWithLabels" >

        </m:Map>
    </Grid>
</UserControl>

Notice we have made our base usercontrol fill the entire screen by removing the width and height attributes, then we have added a xmlns namespace pointing to the virtual earth control and finally added a map to the xaml in ArialWithLabels mode.

Creating then MiniMap Control

Now we need to create the minimap itself, to do this we are going to create a new usercontrol in the Silverlight project. Right mouse click on the project file and click ”Add, New Item" then choose "Silverlight User Control". Name the control "MinMap.xaml".

Now we need to add a Virtual Earth map control to this new minimap control, in the same way we did for the main map in page.xaml:

<UserControl x:Class="MinimapDemo.MiniMap"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="208" Height="208"
    xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
    <Grid x:Name="LayoutRoot">
        <Canvas Canvas.ZIndex="99" Width="200" Height="200" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5">
            <m:Map Name="minimap" Width="200" Height="200" Mode="Road" LogoVisibility="Collapsed" ScaleVisibility="Collapsed" CopyrightVisibility="Collapsed" NavigationVisibility="Collapsed">
            </m:Map>
        </Canvas>
    </Grid>
</UserControl>

This time we have set the base usercontrol to have a width and height of 208 pixels and the map control to have a width and height of 200 pixels these are to set the size of our minimap control and you will see later why the map doesn’t quiet fill the usercontrol. We have added a Canvas control to the grid and used this to Horizontally align the map to the right and vertically align the map to the top when added to a parent control. It’s also added a margin of 5 pixels so that the minimap will be slightly in from the edge of the parent map we are going to add it to. One final thing the canvas provides is setting the z-index, this ensures the minimap control will always be on top of any of the parent maps controls.

We have also added quiet a few attributes to the map control, setting the map to Road style, hiding the logos, navigation, copyrights and scale bar.

Now its time to style the minimap a bit, something we didn’t have allot of flexibility over with the javascript api. We are going to make the map circular and add a opaque white border around the map:

<UserControl x:Class="MinimapDemo.MiniMap"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="208" Height="208"
    xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
    <Grid x:Name="LayoutRoot">
        <Canvas Canvas.ZIndex="99" Width="200" Height="200" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5">
            <m:Map Name="minimap" Width="200" Height="200" Mode="Road" LogoVisibility="Collapsed" ScaleVisibility="Collapsed" CopyrightVisibility="Collapsed" NavigationVisibility="Collapsed">
                <m:Map.Clip>
                    <EllipseGeometry RadiusX="94" RadiusY="94" Center="100,100" />
                </m:Map.Clip>
            </m:Map>
            <Ellipse Width="200" Height="200" Stroke="White" StrokeThickness="6" Opacity="0.7" />
        </Canvas>
    </Grid>
</UserControl>

We have added 2 things this time, a clipping path to the map control by adding an Ellipse to the Map.Clip tag and adding another Ellipse as a sibling control with a white line (stroke) 6 pixels wide and slightly opaque. In the xaml preview the control now looks like this:

minimapxamlpreview

There is one final touch to add to the minimap control before we start working on integrating it with the main map and that is adding a centre marker to the minimap.

<UserControl x:Class="MinimapDemo.MiniMap"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="208" Height="208"
    xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
    <Grid x:Name="LayoutRoot">
        <Canvas Canvas.ZIndex="99" Width="200" Height="200" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5">
            <m:Map Name="minimap" Width="200" Height="200" Mode="Road" LogoVisibility="Collapsed" ScaleVisibility="Collapsed" CopyrightVisibility="Collapsed" NavigationVisibility="Collapsed">
                <m:Map.Clip>
                    <EllipseGeometry RadiusX="94" RadiusY="94" Center="100,100" />
                </m:Map.Clip>
            </m:Map>
            <Ellipse Width="200" Height="200" Stroke="White" StrokeThickness="6" Opacity="0.7" />
            <Ellipse Height="6" Width="6" Fill="#FFFF0000" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="98,98,0,0" />
        </Canvas>
    </Grid>
</UserControl>

We have done this by adding another Ellipse as a sibling to the map control that is 6 pixels wide and high, coloured red and positioned in the middle of our control using a combination of alignments and margins.

Now lets get the maps working together!

Combining Both Maps

To make the minimap actually work as a minimap we need to add a few events and two properties to the minimap’s map control. The events will stop the minimap reacting to a users mouse events, we add these to both the xaml and the code behind:

XAML


<m:Map Name="minimap" Width="200" Height="200" Mode="Road" LogoVisibility="Collapsed" ScaleVisibility="Collapsed" CopyrightVisibility="Collapsed" NavigationVisibility="Collapsed" MouseClick="Map_MouseClick" MouseWheel="Map_MouseWheel" MousePan="Map_MousePan">


Codebehind

namespace MinimapDemo
{
    public partial class MiniMap : UserControl
    {
        public MiniMap()
        {
            InitializeComponent();
        }

        private void Map_MouseClick(object sender, Microsoft.VirtualEarth.MapControl.MapMouseEventArgs e)
        {
            e.Handled = true;//dont want minimap to be interactive
        }

        private void Map_MouseWheel(object sender, Microsoft.VirtualEarth.MapControl.MapMouseWheelEventArgs e)
        {
            e.Handled = true;//dont want minimap to be interactive
        }

        private void Map_MousePan(object sender, Microsoft.VirtualEarth.MapControl.MapMouseDragEventArgs e)
        {
            e.Handled = true;//dont want minimap to be interactive
        }
    }
}

The 3 mouse events have set the event as handled so the default events the map control has for these will not be executed. Now onto the two properties we need to add, these are simply adding a property to control where the minimap is centred geographically and one for its zoomlevel.

        public Location Center
        {
            get
            {
                return minimap.Center;
            }
            set
            {
                minimap.Center = value;
            }
        }

        public double ZoomLevel
        {
            get
            {
                return minimap.ZoomLevel;
            }
            set
            {
                minimap.ZoomLevel = value;
            }
        }

You will need to add "using Microsoft.VirtualEarth.MapControl;" to the code behind before it recognises the Location class. Now before we go any further build the project so that we have the minimap control available.

Now lets actually add the new minimap control to the main page.xaml:

<UserControl x:Class="MinimapDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl"
    xmlns:mm="clr-namespace:MinimapDemo">
    <Grid x:Name="LayoutRoot" Background="White">
        <m:Map Name="mymap" Mode="AerialWithLabels">
            <m:Map.Children>
                <mm:MiniMap Name="minimap" HorizontalAlignment="Right" VerticalAlignment="Top" />
            </m:Map.Children>
        </m:Map>
    </Grid>
</UserControl>

We have added an xml namespace at the top pointing to the current project, this will allow us to use the minimap control. Then we have added the minimap to the Map.Children tag and positioned it in the top right of the map.

We are almost there now, there is just one final thing to do. We need to hook up the main maps TargetViewChanged event so that it moves the minimap to a new location and sets the zoom level appropriately. We do this by adding the event to the xaml and then adding something to the code behind to change the minimap:

XAML

<m:Map Name="mymap" Mode="AerialWithLabels" TargetViewChanged="Map_TargetViewChanged">

Codebehind


        private void Map_TargetViewChanged(object sender, Microsoft.VirtualEarth.MapControl.MapEventArgs e)
        {
            MiniMap minimap = (MiniMap)mymap.FindName("minimap");//get the minimap child control
            minimap.Center = mymap.Center;//change center of mini map
            minimap.ZoomLevel = (mymap.ZoomLevel - 5) < 0 ? 1 : (mymap.ZoomLevel - 5);//make sure minimap is at least zoomlevel 1
        }

In the codebehind first we are finding the minimap control by name from its parent map control (for some reason I have to do it this way where as previously I have just been able to call minimap directly??). Then we are setting the minimap’s Center property to be the same as the main map and finally setting the ZoomLevel property to be 5 less than the main map, unless the main map is zoomed out to level 5 or below itself. That’s if we’re done you should now be able to run the project and load up your working minimap!

minimapfinished

What else can we do?

You can tweak things for your own requirements like the zoom level offset and the size of the minimap pretty easily. You can also make a more exciting centrepoint marker for the minimap using some simple animation but that’s outside the scope of this tutorial. I look forward to seeing some great projects over the next few weeks so get busy building!

UPDATE: John Darling pointed out the minimap in this code seems to be one step behind the main map, after having a look we shoudl be using the zoomlevel and centerpoint of the TargetView (view that the map is currently animating to) rather than the current maps state. Therefore the updated event handler for Map_TargetViewChanged should be:

   1: private void Map_TargetViewChanged(object sender, Microsoft.VirtualEarth.MapControl.MapEventArgs e)
   2: {
   3:     
   4:     MiniMap minimap = (MiniMap)mymap.FindName("minimap");//get the minimap child control
   5:     minimap.Center = mymap.TargetView.Center;//change center of mini map
   6:     minimap.ZoomLevel = (mymap.TargetView.ZoomLevel - 5) < 0 ? 1 : (mymap.TargetView.ZoomLevel - 5);//make sure minimap is at least zoomlevel 1
   7: }

 

Virtual Earth Silverlight Control CTP available Friday, we’ve been playing already

Wednesday, March 18th, 2009

You may have heard the news today that the new Virtual Earth Silverlight map control Community Tech Preview was announced today at MIX09! We have been lucky enough to be Beta testing the control for a few weeks now here at Earthware and its been a real eye opener to the future of interactive mapping.

What’s all the fuss about?

The Silverlight Virtual Earth map control will usher in a new era of multimedia rich, great looking interactive mapping projects that simply were not possible using the existing APIs. Here are a few of the highlights we think the control offers:

  1. Quick and simple animation of the map and data added to it
  2. Scalable user interfaces that will look great on any resolution screen (even mobile in future)
  3. Highly integrated video, audio and imagery much more than just displaying a map popup
  4. Easily skinable map controls
  5. Cross browser compatability! No more css hacks for Virtual Earth or pesky javascript issues
  6. Wrap around maps. For those who have struggled plotting lines across the map from east to west don’t worry, the Silverlight control already allows continuous map wrapping!

The control is not a final release yet so there are a few things that might be better:

  1. There is a learning curve for using Silverlight
  2. The control requires a bit more work from developers; there is no pushpin class or infobox in the current release. This means it’s very flexible but takes a bit more setup for a simple map
  3. There is no birdseye currently, but this is promised for release
  4. There is also no 3D control. Nothing has been mentioned about this but maybe Silverlight 3??
  5. Obviously not everyone has the Silverlight plugin installed yet…

Overall the control is a great start and will allow developers to create some exciting applications not possible before now, but there is still lots of work to do before it’s as easy and comprehensive as the current javascript API.

What have we been doing with the control so far?

Of course the first question we had was what shall we make with the new Silverlight Virtual Earth Map control. We had some ideas which were not easily achievable using the Javascript API.

We cannot show you any code samples until Friday when the CTP is made public but we can show you our first Silverlight Virtual Earth map demo a Silverlight live Twitter map.

twittermap

http://earthware.cloudapp.net/demos/sltwittermap.aspx

This demo uses a combination of live Twitter data, the multimap geocoding api, and the Virtual Earth Silverlight control.

We will hopefully look at releasing some code and coding tutorial after the release on Friday, until then enjoy the demo.

Now we need to start creating a Silverlight version of our estate agent / property mapping product EarthwareProperty!