Reverse Geocoding in Bing Maps With REST Service Using ASP.Net

Reverse Geocoding is the process of back (reverse) coding of a point location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places and/or real subdivisions such as neighbourhoods, county, state or country.

Note

  1. I have used the BingMaps 7.0 JavaScript library to display the Bing map.

  2. The BingMaps 7.0 JavaScript library doesn't support reverse geocoding directly. So use the REST Service.

To get the address for specified points, you need to use the REST URL Template. This template supports both HTTP and HTTPS protocols.

REST URL

http://dev.virtualearth.net/REST/v1/Locations/point?includeEntityTypes=entityTypes&includeNeighborhood=includeNeighborhood&include=includeValue&key=BingMapsKey

Here you need to pass the various parameters to this REST URL to get the location form lat and long. They are listed in the following URL.

Find a Location by Point

I am mainly focusing on the code example. Here we go.

Code

  1. Add the div tag to a .aspx page and call the initialize() method as shown in the following code.

    all initialize method

  2. Also add the BingMaps 7.0 JavaScript library at the top of the page.

    add bingmap

  3. You then need to add the initialize() method code.

    bitmap key

  4. Now add the Ajax call back REST service code.

    REST service code
Example

Just click on map to find the location. It will show an alert window as shown in the figure.

map


Similar Articles