When we show the user the postcode shape of the point he/she clicks on, it is a good idea to also show the name of the postcode. We will use the REST Services to do that; therefore, let's copy the LocatorProxy.cs
and JsonDataContracts.cs
files from the project we built in chapter 3, Introduction to Bing Maps REST Services, and paste them into the Models
folder.
We also copy the QueryByPoint
and GetDescription
methods from HomController
of that project and change them to look like this:
private string QueryByPoint(double latitude, double longitude) { var result = "No results found."; LocatorProxy.QueryByPoint(latitude, longitude, x => { foreach (var resourceSet in x.ResourceSets) { foreach (var resource in resourceSet.Resources) { var postcode = GetPostcode(resource as Location); if (postcode.Length > 1) { result = postcode; return; ...