Book Image

Learning Bing Maps API

By : Artan Sinani
Book Image

Learning Bing Maps API

By: Artan Sinani

Overview of this book

Provided as a part of Microsoft's Bing suite of search engines, Bing Maps is a web mapping service powered by the Bing Maps for Enterprise framework. The need for geospatial data has increased dramatically in the last few years. Adding a mapping context to any location-based data is becoming more and more common, and businesses are embracing it to improve their user experience with new data richness. Comprising of simple, follow-along examples, Learning Bing Maps API will show you how to use the many features of Bing Maps, from dropping a simple map on a web page, to fetching geospatial data from the Microsoft servers. Through the course of this book you will build a solid foundation for creating your own geo-applications.Following the hands-on recipes of this book, you will build a different web app in each chapter as you communicate with different APIs provided by Bing Maps. You will build your own library of JavaScript modules that talk to the Microsoft Maps API.You will create a custom theme for the map, with your own controls. Taking advantage of the global reach of Bing Maps, you will learn how to build a route scheduler for a delivery company in Madrid, Spain, and then you will discover how to create jobs on the Bing Maps servers for geocoding addresses in California, USA. By the end of the book you will have learned everything you need to know to embed a map on a web page, with your own geo-data, or data obtained by the Bing Map Services.
Table of Contents (14 chapters)

Preface

When I first started working with the Bing Maps APIs, I was amazed at how easy it was to drop a map on a web page with just a few lines of code. Then I started changing the way the map looked; then I added some pushpins to show points of interest, and inevitably changed the way the pins looked.

This book describes many of these processes and much more, building on real applications as we explore new venues of the vast universe of Bing Maps.

What this book covers

Chapter 1, Introduction to Bing Maps AJAX Control Version 7, explains how to embed a map on a web page. It shows the way to create a custom theme by changing its interactive controls with a simple dashboard.

Chapter 2, Diving into Bing Maps AJAX Control Version 7, explains how to add interactivity to the map, by drawing custom polygons and pushpins and attaching different events to them.

Chapter 3, Introduction to Bing Maps REST Services, introduces the Locations API and reverse geocoding addresses from coordinates of any point of the map.

Chapter 4, Diving into Bing Maps REST Services, covers the Routes API and ways of fetching and displaying on the map route information between multiple places. It takes a look at different data formats that are exposed by this interface.

Chapter 5, Spatial Data Services, introduces geocoding addresses by setting up automated jobs on the Bing Maps servers. It examines techniques of monitoring the jobs, and on their completion, parsing the response.

Chapter 6, Diving into Spatial Data Services, focuses on an experimental part of Bing Maps, the Geodata API. It presents ways of obtaining geographical information about various types of administrative areas, from postcode to region or country.

Chapter 7, Enriching Bing Maps with Overlaying User Data, wraps up the book with a web application that turns the map into an interactive chart by means of user data visualizations.

What you need for this book

You need some experience with JavaScript, HTML, and CSS. For some chapters, knowledge of C#, ASP.NET MVC, and Visual Studio is also required.

Who this book is for

This book is for developers that wish to build applications with Bing Maps, but have no previous knowledge of the APIs. More experienced developers can find useful chapters about areas of Bing Maps with which they are not familiar.

Conventions

In this book, you will find a number of styles of text that distinguish among different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: We can include other contexts through the use of the include directive.

A block of code is set as follows:

  var map = new Microsoft.Maps.Map(container, {
    credentials: '[YOUR BING MAPS KEY]',
    center: new Microsoft.Maps.Location(39.554883, -99.052734),
    mapTypeId: Microsoft.Maps.MapTypeId.road,
    zoom: 4
  });

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

  8"/>
  <title>LBM | Chapter 1: Introduction to Bing Maps</title>
  <link href="app.css" rel="stylesheet" />

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Before that, we deactivate the active button (by removing the active class) if it exists.

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really find useful.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic in which you have expertise, and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output.You can download this file from: http://www.packtpub.com/sites/default/files/downloads/0371OT_ColoredImages.pdf

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books; maybe a mistake in the text or the code, we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata is verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.