It was just 6 months ago that the Bing Maps Platform team officially launched support for the Silverlight control. This was in addition to the Bing Maps SOAP Service (via Windows Communication Foundation) and the AJAX Control that have been in use for years now. Today, we’re announcing a REST interface into those wonderful maps, aerial images, and geocoding and routing systems for your grubby coding hands to get all dirty. And, the beauty with REST is that you simply need to build URL queries and handle the JSON or XML responses. It’s quite beautiful actually and it’s essentially the way the WWW was architected, so the learning curve will be fairly flat. If you’re too excited to read on and want the SDK now, you can view it online or download it from the Bing Maps Platform site.
Okay, so here’s the scoop on the Bing Maps REST APIs. There are main 4 APIs that allow you to do Geocoding, Render Maps and Imagery, Calculate Routes and Perform Batch Geocoding. Let me break it down for you…
Locations API. The Locations API is for geocoding on the fly. So, in your application when a user enters an address you’ll want to hit the Location API to get a response. The Location API contains 3 main functions:
Location by Address – Pass in an address and we’ll send back a lat/lon pair.
Location by Point – Pass in a lat/lon pair and we’ll send back an address (reverse geocoding).
Location by Query – Pass in a string (address or landmark) and we’ll send back a lat/lon pair.
Imagery API. The Imagery API is for getting maps and aerial photos. When you’re ready to show a map of a location you will want to use the Imagery API. Also, the Imagery API grants you access to imagery metadata such as capture date and provider information.
Map – Getting a map image based on an address, landmark or lat/lon pair.
Imagery Metadata – Getting imagery vintage or provider information based on a lat/lon pair.
Routes API. The Routes API is for calculating driving directions. The Routes API allows you to get route distance calculations, route geometry and step-by-step directions via driving, walking or traffic based algorithms. You can also pass in up to 25 points on your route to calculate a multiple stop route in a single request.
Route – Calculating a route.
Spatial Data API. The Spatial Data API is for batch geocoding. Batch geocoding lets you up load a file for processing addresses through our backend systems without having to make multiple requests using the Locations API. If you have thousands of addresses to geocode at one time, you’re better off using the Spatial Data API.
Upload Data – Creates a batch geocoding job and uploads data into the cloud for geocoding.
Check Job Status – Checks to see whether the job is complete.
Download Data – Once the job is complete, you’ll download the geocoded data.
The REST API also has contextual and cultural properties. Optionally, if you want to shorten the URLs you’re using, you can substitute many of them with acronyms. If you want to show maps in French instead of English, you can set the culture to fr-FR. Also note that all of the sample requests I provided have the “key=BingMapsKey” parameter appended to them. You will need a Bing Maps Key to do any development; but worry not! Keys are free for all to use for developing applications. Get a key in the Bing Maps Portal.
Bing Maps AJAX Control Update – We also enhanced the Bing Maps AJAX Control with some streamlined features and a stripped down mode for light mapping techniques. The new AJAX Control is version 6.3 and has the following changes.
Core functionality version of the map control. The Bing Maps AJAX Control is now available in both full functionality and core functionality versions. If you do not have advanced mapping needs, you can enhance the performance of your map control application by using the core version of the latest map control. Note the version number (v=6.3c) for the core control which is now a slimmed down 35kb!
New Search and Geocode methods. The new VEMap.Search Method and the VEMap.Geocode Method provide an easier way to return the most accurate search results. The current VE.Find Method has like 11 arguments for making your request more specific. If you know what you want and would rather slim your request down to 3 (query, callback, options).
Sample (Geocode): map.Geocode(‘1 Microsoft Way, Redmond, WA’, findCallback, options);
Sample (Search): map.Search(‘Fish Tacos in San Diego’, findCallback, options);
Drag-able pushpins. With the latest version of the Bing Maps AJAX Control, your pushpins become drag-able by simply setting the VEShape.Draggable Property of the pushpin to true. There are also optional events associated with the dragging motion that you can capture and fire off additional events such as search queries or grabbing pixels to convert to lat/lons.
var pushpin = null;
pushpin = new VEShape(VEShapeType.Pushpin, map.GetCenter());
pushpin.Draggable = true;
pushpin.onstartdrag = StartDragHandler;
pushpin.ondrag = DragHandler;
pushpin.onenddrag = EndDragHandler
All good stuff for you Bing Maps Platform developers! I certainly hope to see some cool applications coming from these new APIs. And, if you are a developer, don’t forget to check out the Bing Map Apps API that was also released today. The Bing Map Apps API allows you to submit your Silverlight application to be published on Bing Maps!
Follow me @BingMaps, ^CP