GeoCoding Service Not Returning County Name(i.e Postal Town)
-
Thursday, November 17, 2011 7:26 AM
Am passing Address as "538 basset Rd,Bay Village, OH 44140" to Bing Map Service(i.e GeoCoding Service) and it is not returning County name.
County exist for this address(i.e "Cuyahoga").
FYI:before i was using MapQuest service and it is returning "538 Basset Rd,Bay Village,Cuyahoga,OH 44140".
****************************************************************************************
public FA.MappingWebServices.Address CallBingForGeocode(FA.MappingWebServices.Address address)
{
NameValueCollection bingSettings = (NameValueCollection)ConfigurationManager.GetSection("BingSettings");
BingGeocodeService.GeocodeRequest geocodeRequest = new BingGeocodeService.GeocodeRequest();
// Set the credentials using a valid Bing Maps key
geocodeRequest.Credentials = new BingGeocodeService.Credentials();
geocodeRequest.Credentials.ApplicationId = bingSettings["AppKey"]; ;
// address.County = "Delaware County";
// Set the full address query
geocodeRequest.Query = address.Street + "," + address.City + "," + address.State + "," + address.PostalCode ;
// Set the options to only return high confidence results
ConfidenceFilter[] filters = new ConfidenceFilter[1];
filters[0] = new ConfidenceFilter();
filters[0].MinimumConfidenceSpecified = true;//kk
filters[0].MinimumConfidence = BingGeocodeService.Confidence.High;
// Add the filters to the options
BingGeocodeService.GeocodeOptions geocodeOptions = new BingGeocodeService.GeocodeOptions();
geocodeOptions.Filters = filters;
geocodeRequest.Options = geocodeOptions;
geocodeOptions.Count = 20; // restricted by service to at maximum 20 results
geocodeRequest.Culture = "en-US";
// Make the geocode request
try
{
BingGeocodeService.GeocodeService geocodeService = new BingGeocodeService.GeocodeService();
BingGeocodeService.GeocodeResponse geocodeResponse = geocodeService.Geocode(geocodeRequest);
if (geocodeResponse.Results.Length > 0)
{
address.Latitude = geocodeResponse.Results[0].Locations[0].Latitude;
address.Longitude = geocodeResponse.Results[0].Locations[0].Longitude;
address.State= geocodeResponse.Results[0].Address.District;
address.County = geocodeResponse.Results[0].Address.PostalTown;//return empty
address.County2 = geocodeResponse.Results[0].Address.District; //return empty}
}
catch (Exception ex)
return address;
}****************************************************************************************
please help me how to get county name in GeoCoding service.
even though Reverse GeoCoding Service also not returning County name.
All Replies
-
Thursday, November 17, 2011 7:19 PMOwner
Please post it at another forum. This is not a right forum for the question.
Thanks,
Lev
Lev Nachmanson- Marked As Answer by Lev NachmansonOwner Thursday, November 17, 2011 7:19 PM

