REST Easy; Bing Maps Has You Covered

REST Easy; Bing Maps Has You Covered

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.

Sample: http://dev.virtualearth.net/REST/v1/Locations/US/WA/98052/Redmond/1 Microsoft Way?o=xml&key=BingMapsKey

Location by Point – Pass in a lat/lon pair and we’ll send back an address (reverse geocoding).

Sample: http://dev.virtualearth.net/REST/V1/Locations/47.64054,-122.12934?o=xml&key=BingMapsKey

Location by Query – Pass in a string (address or landmark) and we’ll send back a lat/lon pair.

Sample: http://dev.virtualearth.net/REST/v1/Locations/1 Microsoft Way Redmond WA 98052?o=xml&key=BingMapsKey

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.

Sample (Road): http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/space needle,seattle?mapLayer=TrafficFlow&key=BingMapsKey

Sample (Aerial with Labels): http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels/statue of liberty nyc?mapSize=800,600&key=BingMapsKey


Imagery Metadata – Getting imagery vintage or provider information based on a lat/lon pair.

Sample: http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Aerial/40.714550167322159,-74.007124900817871?zl=15&output=xml&key=BingMapKey

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.

Sample: http://dev.virtualearth.net/REST/V1/Routes/Walking?wp.0=Eiffel%20Tower&wp.1=louvre%20museum&optmz=distance&output=xml&key=BingMapsKey

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.

Sample: http://spatial.virtualearth.net/REST/v1/Dataflows/Geocode?input=xml&description=My dataflow&key=BingMapsKey

Check Job Status – Checks to see whether the job is complete.

Sample: http://spatial.virtualearth.net/REST/v1/Dataflows/e14b1d9bd65c4b9d99d267bbb8102ccf?key=b1c323ea234

Download Data – Once the job is complete, you’ll download the geocoded data.

Sample: https://spatial.virtualearth.net/REST/v1/dataflows/Geocode/5bf10c37df944083b1879fbb0556e67e/output/succeeded&key=MyDataflowJobKey

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 WEB Control Update – We also enhanced the Bing Maps Web Control with some streamlined features and a stripped down mode for light mapping techniques.

All good stuff for you Bing Maps Platform developers! Try these for yourself using the Interactive SDK!

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 latest Bing Map APIs