Bing Maps V6.3 to V8 Bing Maps V6.3 to V8 Migration Guide
Total Page:16
File Type:pdf, Size:1020Kb
Migration Guide Bing Maps V6.3 to V8 Bing Maps V6.3 to V8 Migration Guide Table of Contents 1.0 Introduction ............................................................................................................................................ 3 1.1 Purpose of this Guide .......................................................................................................................... 3 1.2 But I’m not using v6.3, I’m using v5 or 6.x .......................................................................................... 3 1.3 Why Bing Maps v8? ............................................................................................................................. 3 1.4 Service Comparison............................................................................................................................. 3 1.5 Notable Changes ................................................................................................................................. 6 1.6 Suggested Migration Plan ................................................................................................................... 6 1.7 Next Steps ........................................................................................................................................... 6 1.8 Technical Resources ............................................................................................................................ 6 2.0 Authentication ........................................................................................................................................ 7 2.1 Getting a Bing Maps Key ..................................................................................................................... 7 2.2 How to authenticate the map ............................................................................................................. 7 3.0 Localization ............................................................................................................................................. 9 4.0 Mapping Examples ................................................................................................................................ 10 4.1 Loading a Map ................................................................................................................................... 10 4.2 Map Navigation ................................................................................................................................. 12 4.3 Geocoding ......................................................................................................................................... 14 4.4 Reverse Geocoding ........................................................................................................................... 15 4.5 Adding a Pushpin .............................................................................................................................. 16 4.6 Adding Shapes ................................................................................................................................... 17 4.7 Shape Layers & Collections ............................................................................................................... 19 4.8 Displaying Routes .............................................................................................................................. 20 5.0 Additional Bing Maps Tips ..................................................................................................................... 25 5.1 Optimizing Transactions with the REST services ............................................................................... 25 5.2 Bing Maps V8 Tips & Tricks ............................................................................................................... 25 5.3 Determining a User’s Location .......................................................................................................... 28 6.0 Useful Tools & Support ......................................................................................................................... 30 6.1 Migration Support ............................................................................................................................. 30 6.2 Bing Maps Blog .................................................................................................................................. 30 6.3 Bing Maps v7 Modules CodePlex project ......................................................................................... 30 Appendix A: Bing Maps v6.3 to v8 class Mapping ...................................................................................... 31 A1: Class Type Mapping .......................................................................................................................... 31 Bing Maps V6.3 to V8 Migration Guide A2: Map Functions Mapping ................................................................................................................... 33 Bing Maps V6.3 to V8 Migration Guide 1.0 Introduction 1.1 Purpose of this Guide This guide is designed to support you in your Bing Maps migration from version 6.3 to version 8. This resource provides detailed comparisons between the JavaScript API of these two versions of Bing Maps as well as comparative code samples, migration suggestions and best practices for migrating your code to the newest version of Bing Maps. As you read this document you should gain an understanding of the benefits of Bing Maps v8 and how to leverage it in your existing mapping applications. 1.2 But I’m not using v6.3, I’m using v5 or 6.x It is possible that your application appears to be pointing to older versions of Bing Maps (i.e. v6.2 or v5), however these versions are actually redirecting to the v6.3 control on the backend and have been doing so for over 6 years. So in reality your application is using v6.3. 1.3 Why Bing Maps v8? The version 6.3 of Bing Maps has been around for over 7 years and hasn’t seen any code updates since the release of Bing Maps v7, 6 years. Version 8 of Bing Maps was just recently released and offers numerous advantages over both v6.3 and v7, including: Faster and more fluid map control A cleaner, more modern, programming model Increased culture support World Wrap support Improved Routing Capabilities Traffic data available in outside of the US Ability to optimize transactions using map sessions Mobile browser support Many new features 1.4 Service Comparison The Bing Maps v8 web control is the recommended migration path from v6.3. There is a small learning curve as there has been some notable improvements made in the code syntax from v6.3 to v8. Faster and more fluid map control When it comes to performance the v8 is miles ahead of v6.3. Version 8 is capable of rendering data much faster than versions 6.3 and 7, and can also render a lot more data too. When dealing with small data sets on a standard browser this might not be that noticeable but if you need to display a large data set or are using a mobile browser this increased performance makes a big difference. Noticeable performance issues in v6.3 have generally occurred when 200 or more pushpins have been added to the map, while v8 is capable of rendering thousands of pushpins and polygons with good performance. A cleaner, more modern, programming model. One of the most notable changes in v8 is that the API uses a Microsoft namespace. Doing this significantly reduces code conflicts between 3rd party JavaScript libraries. This also significantly speeds up the map control as there are less global variables for the browser to keep track of. In v6.3 the code Bing Maps V6.3 to V8 Migration Guide was made to be backwards compatible with previous versions of Bing Maps. This was a nice feature but resulted in the map control growing significantly and in some cases multiple functions were created that did the same thing thus making the API much more confusing to use than needed. Version 8 also uses a modular framework. Many features of the map API are needed when the page loads. By modularizing the API additional features can be loaded when need, often sometime after the page has loaded. As a result, the initial JavaScript downloaded which contains the core functionalities needed to load the map and display data on it is significantly smaller than the JavaScript downloaded by v6.3. Increased culture support Version 6.3 supported 22 different culture codes (languages). Version 8 supports significantly more culture codes and uses the Bing Maps REST services to perform geocode and route requests which has support for 117 languages. World Wrap Support In v6.3 of Bing Maps the map consisted of a single map that was disconnected at the edges. In reality we know that the far edges of the map wrap around and attach in real life but we can’t see this in v6.3. This becomes an issue if you want to represent information that crosses that edge. In v6.3 if you try and draw the shortest path between Sydney Australia and Los Angeles, USA it would take you across the full map. In v8 the map wraps around such that we can continually pan left or right just as if you were to spin a globe. In addition to this if you were to repeat the previous task of drawing a shortest path, v8 would draw the line going over the Pacific Ocean which is the shortest most logical route to take. Overall this makes for a much better user experience. Improved routing capabilities In v8 not only can you easily render routes on the map but