| Ricky's profileRicky's Bing Maps BlogBlogSkyDrive | Help |
|
|
11/27/2009 Bing Maps Custom Tile SkinnerThere is a product called “CloudMade” which gives you the ability to choose amongst a large number of map types that have different skins. You can either create your own skins or use a pre-existing skin from the following page http://maps.cloudmade.com/editor. As cool as this is it would be even cooler if we could do something like this in Bing Maps. This post is going to describe a method that can be used to re-skin the default road tiles from Bing Maps. The idea is to create a service that downloads a tile and uses graphic tools to transform the colors on the tile. This is similar to what was done in the “Dynamic Tile Layers in the Bing Maps Silverlight Control” which can be found here: http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!1047.entry. The first step is to create a service (Generic ASHX handler in this case) that takes in a quadkey, culture and transformation type parameters via a query string. This service will the create a URL to retrieve tiles from Bing Maps. A tile will be downloaded and turned into a bitmap image so that it can be used with .NET graphic tools. For the examples in the demo the ImageAttibutes class is sued to create the transformation. The two key methods used to transform the colors consist of using ColorMatrix or a ColorMap. By using a color matrix all the colors on the tile can be changed within a couple lines of code. Using a ColorMap allows you to change one color at a time. This is useful if you only want to change a few colors on the map. In the example application I have showed how to convert the tiles to grey scale, invert the colors, and how to use a custom color map. Complete source code can be found here: http://cid-e7dba9a4bfd458c5.skydrive.live.com/self.aspx/VE%20Sample%20code/CustomMapTileSkins.zip To get this code to work you will need to add your Bing Maps API Key to the MainPage.xaml.cs file. Note that by using this method there is a performance lose as the tiles on the map are no longer being loaded from the Bing Maps cloud but from your tile service. Here are some screen shots of the different skins used in this code: Grey Scaled tiles Inverted Tiles Custom Color Mapping 11/26/2009 Dynamic Tile Layers in the Bing Maps Silverlight ControlYesterday I was scheduled to present at Microsoft Reading unfortunately things came up at work and I could not attend. A colleague of mine filled in and gave my presentation. For all those who are interested in this presentation the slides, complete source code and database can be downloaded here: http://cid-e7dba9a4bfd458c5.skydrive.live.com/self.aspx/VE%20Sample%20code/Silverlight.DynamicTileLayers.zip This demo shows how to dynamically create map tiles from raw data that is stored in SQL 2008 and display them in both the Silverlight and AJAX map control. Steps to get this demo to work:
Why use dynamic tile layers:
11/11/2009 Free Bing Maps EventsThere are two Bing events coming up that you should attend if you are in the area. Developing with Bing Maps & Silverlight Location: Microsoft The Bing Maps Platform brings location data to life by making it easier to visualize, understand and analyze. It’s already being used by thousands of governments, companies and organizations worldwide. This developer focused event will show you how to build well performing and visually engaging web mapping applications using the Bing Maps Silverlight control. The event will begin with an update, bringing you up to speed with the latest from the Bing Maps platform. The rest of the agenda will cover some of the more standard mapping requirements such as database connections, before diving into the more sophisticated spatial analysis and performance optimization. The Bing Maps team will be joined by partners Earthware and Infusion Development. Earthware will showcase their development of the Bing Maps World Tour using the Silverlight Control and Windows Azure, whilst Infusion will demonstrate how to create dynamic tile layers in order to visualize large amounts of frequently changing data. You can register here: http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032428360&Culture=en-GB Bing Maps UK User Group – First Meeting Location: Microsoft London Our first meeting of the new Bing Maps UK User Group. Open to all newbie's, experienced and Bing maps wizards there should be something for everyone. More information here: http://bingmapsuk.ning.com/events/inaugural-uk-bing-maps-ug 11/10/2009 Migrating from Bing Maps Silverlight CTP to Production versionWith the official release of the Bing Maps Silverlight control there has been some changes from the CTP version. This article will address the required changes needed to migrate from the CTP version to the production version. The first change is that the control now requires Silverlight 3. So if you are still using Silverlight 2 you will have to upgrade. You can get the required files to upgrade to Silverlight 3 here: http://silverlight.net/getstarted/ With the production version being released you are now required to authenticate the map. In the CTP version Microsoft took care of the authentication. The Silverlight control does not use tokens like the AJAX control; you can now use an application key. This removes the need to retrieve a client token when you load your map which means faster loading times. To get a key you first need an account. You can get an account here: https://www.bingmapsportal.com. After creating an account you can sign in using your Windows Live ID. Once signed in you can create up to 5 keys by clicking on the Create or view keys on the left side panel. To create a new key, enter the name of your application and the URL which corresponds to the website where the key will be used. Then click the Create key button. Once the key is created you can copy it and use it in your code. There are two ways to add this application id to your code. The first is to set the ApplicationId property of an ApplicationIdCredentialsProvider object and then use this object to set the CredentialsProvider property of the MapBase object. Alternatively you can add the application key to the XAML like so:
You will need to update your Virtual Earth map control assembly reference. The new assemblies have been renamed as well. You will need to replace Microsoft.VirtualEarth.MapControl.dll with both Microsoft.Maps.MapControl.dll and Microsoft.Maps.MapControl.Common.dll. With the change in assemblies the namespaces have also changed. Here is a mapping of the new namespaces:
The following classes and properties have been removed or modified:
|
|
|