Skip to main content

Development

How to use the Bing Maps in your application

Abstract: Bing Maps is an online mapping service that enables users to search, discover, explore, plan and share information about specific locations. It provides a variety of service API to support a lot kinds of the map application. I believe you can find a one that will be useful for your applications and systems.

  1. Introduction

Bing Maps Control is the window where you can start your travel in Bing Maps applications. The Bing Maps Controls need be licensed by Microsoft. The license used to be a Bing Map Keys. You need register in the Microsoft Bing Maps Developer Center and submit your application information to help you to get a Bing Map Keys. Then you need to refer the JS library of Bing Maps Control in your web applications. Finally, you populate the Bing Map access by Bing Maps Control API according to its official user manual. Of course, don’t forget to set your Bing Map Keys as credentials for Bing Maps Controls access.

  1. Get Bing Map Keys

Before the usage of Bing Maps Control, the Bing Maps Keys is required. Login Microsoft Bing Maps Developer Center: https://www.microsoft.com/maps/Default.aspx. Find keys population steps in the Get Start pages. There are two kinds of keys: Basic Keys and Enterprise Keys. The Basic Keys is open for free. Usually, it is used to build some demonstrated applications. The enterprise keys are required if you want to use the Bing Map in one business application.  By anyway, you can get the Bing Maps like the below diagram shows.

1

  1. Populate Bing Maps by Ajax Control

You can find detail help information on the official site: https://cn.bing.com/mapspreview/sdk/mapcontrol/isdk.

2As the above diagram shows, this is the sample code of Traffic Map population. At first, you need set the basic configuration. You need to pass the configuration as the second parameter to Microsoft.Maps.Map class. The credentials are required. Its value should be a Bing Maps Key mentioned the previous chapter. In general, you will also figure out the center which is a pair of longitude and latitude coordinate. There are more parameters you can use to customize map. And you can find it in the MSDN document: https://msdn.microsoft.com/en-us/library/mt712646.aspx. Of course, you may tell me that you don’t know the coordinate. But you know the address of target or the Zip Code. There is a Restful interface which can help you to solve the problem. Please find it in the following link: https://msdn.microsoft.com/en-us/library/ff701714.aspx.

  1. Populate Bing Maps by Restful

Of course, you don’t want to use the Bing Maps Control API. It looks like a little complicated. So you may have a try of the Restful API: https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/{{latitude}},{{longitude}}/12?centralpoint={{latitude}},{{longitude}};&dcl=1&mapSize=500,500&mapLayer=TrafficFlow&key={{bingkey}}. You can use it like the common Restful application. The key is required to be set to a Bing Map Key. I think you can find more information in the following link: https://msdn.microsoft.com/en-us/library/ff701724.aspx.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram