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
- I have used the BingMaps 7.0 JavaScript library to display the Bing map.
- 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
- Add the div tag to a .aspx page and call the initialize() method as shown in the following code.
- Also add the BingMaps 7.0 JavaScript library at the top of the page.
add bingmap
- You then need to add the initialize() method code.
- Now add the Ajax call back REST service code.
Example
Just click on map to find the location. It will show an alert window as shown in the figure.