如何将世界上所有国家/城市/州放入我的数据库? [英] How to put all countries/cities/states of the world into my database?

查看:31
本文介绍了如何将世界上所有国家/城市/州放入我的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个棘手的架构和网络问题.我正在尝试为 http://www.comehike.com 制作一个关于世界上每个城市徒步旅行的页面

I have a difficult architectural and web problem. I am trying to make a page about hiking for every city in the world for http://www.comehike.com

我必须以某种方式导入世界上所有的城市并按州构建它们,而州又按国家/地区构建.

I have to somehow import all the cities in the world and structure them by state, which is in turn structured by country.

我已经有一个国家列表,我手动添加到数据库中,然后添加了加利福尼亚的所有城市(如果考虑小地方,则有 300 多个),然后意识到我无法做到这一点世界上所有城市的精确手工.

I already have a list of countries which I added by hand into the db, then added all the cities of California (there are 300+ if you consider small places), and realized there will be no way for me to do this by hand with accuracy for all the cities in the world.

有没有办法以自动化的方式做到这一点?我从哪里得到可靠的数据?理想情况下,我也会有他们的纬度/经度.

Is there a way to do this in an automated fashion? Where do I get the reliable data from? Ideally I would have their lat/lng as well.

推荐答案

您可以从 GeoNames -- 这是一个文本文件,可以很容易地解析相关信息.如果免费数据不足以满足您的需求,他们还会提供经过验证且质量控制更高的数据,但需要付费.

You can download free geographical data from GeoNames -- this comes in a text file from which the pertinent information can easily be parsed. If the free data is not reliable enough for your needs, they also offer verified data with higher quality control for a fee.

这篇关于如何将世界上所有国家/城市/州放入我的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆