地理位置-如何获得州和县?(或者,如何从邮政编码中获取州和县)C#

地理位置-如何获得州和县?(或者,如何从邮政编码中获取州和县)C#,c#,geolocation,location,geoip,C#,Geolocation,Location,Geoip,我正在使用一种方法从IP地址获取IipLocation对象。这是返回位置对象的代码: public IIpLocation GetIpLocation(IPAddress ipAddress) { ipAddress.CheckNull("ipAddress"); IIpLocation ipLocation = null; try { //Try to look up the location using MaxMind. Lo

我正在使用一种方法从IP地址获取IipLocation对象。这是返回位置对象的代码:

public IIpLocation GetIpLocation(IPAddress ipAddress)
{
    ipAddress.CheckNull("ipAddress");

    IIpLocation ipLocation = null;
    try
    {
        //Try to look up the location using MaxMind.
        Location location = GetMaxMindIpLocation(ipAddress);

        //If the postal code is not present, then try to look it up with GeoNames.
        if (location != null && (location.PostalCode == null || location.PostalCode.Equals("")))
        {
            location.PostalCode = GetPostalCodeFromGeoNames(location);
        }

        if (location != null)
        {
            ipLocation = new GeoIpLocation(location);
        }
    }
    catch (NullReferenceException)
    {
        Log.ErrorFormat(Resources.log_maxMindLookupFailed, ipAddress);
    }

    return ipLocation;
}
IipLocation对象具有以下属性:
地区
地区名称
国家代码
城市
邮政编码
纬度
经度
。但是,我需要州和县。如何从我掌握的信息中获取州和县?

使用此功能

例:


这太棒了!谢谢,我有点困惑。
GetMaxMindIpLocation()
来自哪里?拥有您要查找的所有数据。