问题描述
我正在寻找以编程方式获取给定美国城市驻留的美国县名的最佳/最简单的方法。似乎没有一个简单的API可用于此类(看似简单)的任务?您可以下载一个免费的县/城市/邮政编码信息数据库,例如:
(无需注册或支付)
将整个或其子部分导入本地持久性数据存储库(例如数据库),并在需要查看时查询它注意:自发布此答案以来,县信息已从原始链接的.csv文件中消失。
此链接不再包含县信息:
I'm looking for the best/easiest way to programmatically grab the name of the US county a given US city resides in. It doesn't seem there's a straightforward API available for such a (seemingly simple) task?
You can download a freely-available database of county/city/zip code info such as this one:http://www.unitedstateszipcodes.org/zip-code-database/ (no need to register or pay)
Import it whole, or a subsection of it, into a local, persistent data store (such as a database) and query it whenever you need to look up a city's county
Note: County info has disappeared from the originally-linked .csv file since this answer was posted.This link no longer contains county information: http://federalgovernmentzipcodes.us/free-zipcode-database.csv
这篇关于查找美国城市所在美国的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!