Geocoding with Virtual Earth

***Updated 2023 ***

Please refer to the following 2 blogs for Geocoding today:
What Is Geocoding? - Everything You Need To Know | Maps Blog (bing.com)
Batch Geocoding and Batch Reverse-Geocoding with Bing Maps | Maps Blog

You can also see some great samples, with source code on Github at:
Bing Maps Samples (bingmapsportal.com)

--- Updated Blog Content ---
I’ve received a few inquiries about how to geocode with Virtual Earth. I thought this was pretty straight forward, but after hearing some feedback I figured it made sense to document this a bit further than the SDK does.

First off, you should always pre-geocode and store locations that show up on the map in some kind of database. You can store your locations in Spatial Data Service for this which has free access for developer accounts. 

If all you want is a geocode, you can line up all the address parameters like the sample using Microsoft's main corporate address and you’ll get a result. The API call looks something like this:

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

This is all fine and dandy if you just want to geocode that address because it returns the information for this this location; that can then be used to show where this is on a map or navigate to or from this location. Note, however, that this API call will return two different "point" values as follows: /p>

               "geocodePoints":[  
                  {  
                     "type":"Point",  
                     "coordinates":[  
                        47.640120461583138,  
                        -122.12971039116383  
                     ],  
                     "calculationMethod":"InterpolationOffset",  
                     "usageTypes":[  
                        "Display"  
                     ]  
                  },  
                  {  
                     "type":"Point",  
                     "coordinates":[  
                        47.640144601464272,  
                        -122.12976671755314  
                     ],  
                     "calculationMethod":"Interpolation",  
                     "usageTypes":[  
                        "Route"  
                     ]  
                  } 

As you might guess, "usageType" lets you know that you would use "Display" to show where this is on a map but you would use "Route" in a further call for driving directions. Think about the situation where you are going to a large building or shopping mall. the place you might show on a map as the center of that building might not be reachable by a vehicle so a call to route a vehicle there might fail. This is why the API returns two co-ordinates for a location, one for viewing and one for accessing the building from the outside.