This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
map_suite_desktop_for_wpf_how_to_use_bingmaps [2018/03/29 20:25] cloudhu created |
map_suite_desktop_for_wpf_how_to_use_bingmaps [2018/03/30 21:30] (current) cloudhu |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Map Suite Desktop For Wpf How to Use Bingmaps ====== | + | ====== How to Use Bing Maps in Map Suite Desktop (WPF) Edition====== |
- | + | ||
- | <div msgbox> | + | |
- | **Note:** If you are using Map Suite 9.0 or previous versions of Map Suite product, please go to [[map_suite_wpf_desktop_edition|MapSuite 9.0 Wiki]]. The current page is for Map Suite 10.0 and future versions. It has different assemblies, licensing strategy and ways of distribution, and more. although the majority of previously built code should work without modification assuming the new namespaces are added. For guidance on upgrading your existing code to Map Suite 10, please check out [[map_suite_10_upgrade_guide|MapSuite 10 Upgrade Guide]]. </div> | + | |
This guide helps you to create a bing maps key and apply it in Map Suite. | This guide helps you to create a bing maps key and apply it in Map Suite. | ||
- | ===== Getting Started ===== | + | Basically, there are two types of bing maps keys. One is Basic Key, and the other one is Bing Maps Enterprise Key. ( see picture 1 below ) |
- | Basically, there are two types of bing maps key. One is Basic Key, and the other one is Bing Maps Enterprise Key. ( see pic1 below ) | + | {{:bingmapkeys.png?850|picture 1}} |
- | {{:bingmapkeys.png?500|}} | ||
- | <pic1> | ||
- | === How to Create Key === | + | === How to Create a Basic Key ( Notice: This key is only for developing/testing purpose. ) === |
- | [[https://www.microsoft.com/en-us/maps/create-a-bing-maps-key|Basic Key]] | + | - Go to the [[https://www.bingmapsportal.com/|Bing Maps Dev Center]]. |
- | + | - Log in with your Microsoft account. ( Note: If you do not have one, create one then log in. ) | |
- | - Go to [[https://www.bingmapsportal.com/|the Bing Maps Dev Center]]. | + | - Click My Account and select My keys. |
- | - Login your Microsoft account. ( Note: If you do not have one, create one then login. ) | + | |
- | - Click My account and select My keys. | + | |
- Select the options to create the key. ( Note: If you already have an existing key, you may use that key. ) | - Select the options to create the key. ( Note: If you already have an existing key, you may use that key. ) | ||
Line 27: | Line 20: | ||
- | [[https://www.microsoft.com/en-us/maps/create-a-bing-maps-key|Bing Maps Enterprise Key]] | + | === How to Create a Bing Maps Enterprise Key === |
- Go to [[https://www.microsoft.com/en-us/maps/licensing/#request-quote|the licensing page]] to read more and get a quote. | - Go to [[https://www.microsoft.com/en-us/maps/licensing/#request-quote|the licensing page]] to read more and get a quote. | ||
- | === Code Sample === | + | === How to Use Bing Maps Key in Map Suite Desktop Edition === |
- | + | ||
- | Download [[source code link will be in here|Sample Source Code]] | + | |
- | + | ||
- | + | ||
- | === How to Apply Key === | + | |
- | {{:applybingkey.png?500|}} | + | The BingMapsTileOverlay will work after assigning your Bing Maps Key to the property BingMapsOverlay.ApplicationId. Here below is how to do that in a sample. |
- | <pic2> | + | |
- | - Open the app.config file. | + | - Download [[source code link will be in here|Sample Source Code]] and open it in Visual Studio. |
- | - Place the key to the appropriate field. (see pic2 above) | + | - Open MainWindow.xaml.cs and replace the value in the appropriate field. ( see the code sample below ) |
+ | - Restore NuGet Packages, build and run the sample. | ||
=== Code Usage === | === Code Usage === | ||
- | // Bing maps core by using BingMapsTileOverlay() | + | // Create a BingMapsTileOverlay and add it to wpfMap1 |
BingMapsTileOverlay bingMapsOverlay = new BingMapsTileOverlay(); | BingMapsTileOverlay bingMapsOverlay = new BingMapsTileOverlay(); | ||
bingMapsOverlay.MapStyle = BingMapsMapType.AerialWithLabels; | bingMapsOverlay.MapStyle = BingMapsMapType.AerialWithLabels; | ||
- | bingMapsOverlay.Name = "Bing Maps Aerial"; | + | bingMapsOverlay.ApplicationId = "Place Bing Maps Key Here"; |
- | bingMapsOverlay.ApplicationId = System.Configuration.ConfigurationManager.AppSettings["BingMapKey"]; | + | |
- | bingMapsOverlay.IsVisible = false; | + | |
wpfMap1.Overlays.Add(bingMapsOverlay); | wpfMap1.Overlays.Add(bingMapsOverlay); | ||
- | | ||
- | // where you can add the keys | ||
- | <appSettings> | ||
- | <add key="BingMapKey" value="Place Your Bing Maps Key Here" /> | ||
- | </appSettings> | ||
\\ | \\ |