private void LocationRecogBtn_Clicked(object sender, RoutedEventArgs e) { var r = new LocationRecogRequest() { BingMapsKey = BingMapsKey, CenterPoint = new Coordinate(47.668697, -122.376373) }; ProcessRequest(r); }
/// <summary> /// Location Recognition Test /// /// https://msdn.microsoft.com/en-US/library/mt847173.aspx /// </summary> static public void LocationRecogTest() { Console.WriteLine("Running Location Recognition Test"); Coordinate cpoint = new Coordinate(47.668915, -122.375789); Console.WriteLine("coord: {0}", cpoint.ToString()); var request = new LocationRecogRequest() { BingMapsKey = _ApiKey, CenterPoint = cpoint }; var resources = GetResourcesFromRequest(request); var r = (resources[0] as LocationRecog); if (r.AddressOfLocation.Length > 0) { Console.WriteLine($"Address:\n{r.AddressOfLocation.ToString()}"); } if (r.BusinessAtLocation != null) { foreach (LocalBusiness business in r.BusinessAtLocation) { Console.WriteLine($"Business:\n{business.BusinessInfo.EntityName}"); } } if (r.NaturalPOIAtLocation != null) { foreach (NaturalPOIAtLocationEntity poi in r.NaturalPOIAtLocation) { Console.WriteLine($"POI:\n{poi.EntityName}"); } } Console.ReadLine(); }