是否有类或库可以获取给定国家/地区的州列表?

发布于 2025-01-02 07:26:00 字数 614 浏览 3 评论 0原文

可能的重复:
国家、州、省 Web 服务?

此“原始”链接仅显示网络服务或我可以手动插入列表的位置。有谁知道有一个库/内置类/dll 不需要访问另一台服务器来获取数据,也不需要手动输入每个州?

我目前正在添加对加拿大、墨西哥和巴西的支持,(可能很快)到 ASP.NET 网站。用户可以通过下拉列表输入他们的物理地址,包括他们的状态。我目前手动添加了美国各州,例如:

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

在我继续开始手动创建其他国家/地区的列表之前,是否有一些预构建的类或库可以通过传递国家/地区代码来为我提供州列表?示例:someClass.getStatesFor("BR"); // 将返回巴西的州列表/集合。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

末蓝 2025-01-09 07:26:00

您可以在 http://www.geonames.org 上找到所需的数据。状态信息被称为“行政分区”。

此数据可作为网络服务提供,但您也可以下载。
数据描述可以在此页面找到:http://download.geonames.org/export /dump/readme.txt

有各种语言的组件,但我认为这些组件是为了访问网络服务。

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.

蹲墙角沉默 2025-01-09 07:26:00

这是一个替代方案:
http://www.iso.org/iso/country_names_and_code_elements

ISO 列表始终处于更新状态 -迄今为止。

希望这些有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文