Geocoding.Google.GoogleGeocoder.ReverseGeocode C# (CSharp) Method

ReverseGeocode() public method

public ReverseGeocode ( Location location ) : IEnumerable
location Location
return IEnumerable
		public IEnumerable<GoogleAddress> ReverseGeocode(Location location)
		{
			if (location == null)
				throw new ArgumentNullException("location");

			return ReverseGeocode(location.Latitude, location.Longitude);
		}

Same methods

GoogleGeocoder::ReverseGeocode ( double latitude, double longitude ) : IEnumerable

Usage Example

    public static void markers_address(object[] lat_long)
    {
        Dictionary<int, Dictionary<string, object>> struc = new Dictionary<int, Dictionary<string, object>>();
        Dictionary<string, object> inner = new Dictionary<string, object>();
        List<string> lat_long_pair = new List<string>();
        for (int i = 0; i < lat_long.Length; i++)
        {
            inner = (Dictionary<string, object>)lat_long.GetValue(i);
            foreach (var pair in inner)
            {
                string a = pair.Key;
                object b = pair.Value;
                string lat_lng_str = (string)Convert.ChangeType(b, typeof(string));
                lat_long_pair.Add(lat_lng_str);
            }
        }

        // convert lat-long to place
        var locationService = new GoogleLocationService();
        // List<string> marker_place = new List<string>();
        var count = 0;
        marker_place.Clear();
        for (int i = 0; i < lat_long_pair.Count; i = i + 2)
        {
            IGeocoder geocoder = new GoogleGeocoder() { };
            try
            {
                IEnumerable<Address> addresses = geocoder.ReverseGeocode(Convert.ToDouble(lat_long_pair[i]), Convert.ToDouble(lat_long_pair[i + 1]));

                foreach (Address adr in addresses)
                {
                    if (count == 0)
                    {
                        string address = adr.FormattedAddress;
                        marker_place.Add(address);
                    }
                    break;
                }
                count = 0;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
    }
All Usage Examples Of Geocoding.Google.GoogleGeocoder::ReverseGeocode