2

Possible Duplicate:
Country, State, Province WebService?

This "orignal" link only shows web services or places I can get lists to insert manually. Does anyone know of a library / built in class / dll that wouldn't require hitting another server for the data and not require manual entry of each state?

I am currently adding support for Canada, Mexico, and Brazil, (and potentially more soon) to an ASP.NET website. The user can input their physical address including their state via drop down list. I currently have the US states added manually like:

states.Add(new ListItem("Alabama", "AL"));
states.Add(new ListItem("Alaska", "AK"));
etc ...

Before I go ahead and start manually creating lists for the additional countries, is there some pre-built class or library out there that can give me a list of states by passing it a country code? Example: someClass.getStatesFor("BR"); // would return a list/collection of states for Brazil.

Community
  • 1
  • 1
ToddBFisher
  • 11,370
  • 8
  • 38
  • 54
  • Would a web service be acceptable? – M.Babcock Feb 02 '12 at 18:49
  • 3
    http://stackoverflow.com/questions/121117/country-state-province-webservice – L.B Feb 02 '12 at 18:51
  • Maxmind is also a good resource. http://www.maxmind.com/ – Lloyd Feb 02 '12 at 19:01
  • As an aside: not all countries consider their equivalent to "states" as an important part of an address. That is, if a website made me fill out a drop box with a province for my country as a required field I'd close the site on account of it being annoying. – millimoose Feb 03 '12 at 02:39

2 Answers2

5

You may find the data you need on http://www.geonames.org. State information is referred to as administrative subdivision.

This data is available as a webservice, but you may also download it. The data description can be found on this page: http://download.geonames.org/export/dump/readme.txt

There are components for various languages, but I think those are to access the web services.

marapet
  • 54,856
  • 12
  • 170
  • 184
1

Here is an alternative: http://www.iso.org/iso/country_names_and_code_elements

The ISO list is always up-to-date.

Hope these help.

Jacob
  • 3,598
  • 4
  • 35
  • 56
AnnieMacD
  • 58
  • 5