public void GeoCountryInfo_ByISO()
        {
            var g2 = GeoCountryInfo.ByISO("AU");

            Assert.AreEqual("AU", g2.ISO2);

            var g3 = GeoCountryInfo.ByISO("USA");

            Assert.AreEqual("USA", g3.ISO3);
        }
        public CartoPlaceData ParsePlace(string place)
        {
            var p = new CartoPlaceData();

            p.Name = place;

            var index = place.LastIndexOf(',');

            if (index > 0)
            {
                var name        = place.Substring(0, index).Trim();
                var countryCode = place.Substring(index + 1).Trim();

                var country = GeoCountryInfo.ByISO(countryCode);
                if (country != null)
                {
                    p.Name    = name;
                    p.Country = country.Name;

                    index = name.LastIndexOf(',');
                    if (index > 0)
                    {
                        var area = name.Substring(index + 1).Trim();
                        name = name.Substring(0, index).Trim();
                        if (country.HasRegions)
                        {
                            var region = GeoRegionInfo.ByISO(country.ISO2, area);
                            if (region != null)
                            {
                                p.Region = region.RegionName;
                                p.Name   = name;
                            }
                            else
                            {
                                p.Locality = area;
                                p.Name     = name;
                            }
                        }
                        else
                        {
                            p.Locality = area;
                            p.Name     = name;
                        }
                    }
                }
            }

            return(p);
        }