开发者

get state and county a city belongs to with geonames database?

开发者 https://www.devze.com 2022-12-23 07:12 出处:网络
i have downloaded whole database from geonames.org and imported all countri开发者_StackOverflow中文版es into mysql.

i have downloaded whole database from geonames.org and imported all countri开发者_StackOverflow中文版es into mysql.

i wonder how i can get the continent, country, state, county when i got a city's id?

cause i want to make a cascading list menu with these information.

thanks!


Looking things over, all the data that you are asking for appears to exist in their dataset. The exact query you are looking for should be pretty easy to come up with assuming that you imported everything in a relatively straightforward fashion.

Basically, you'll need to join the geonames table against the admin1codes and admin2codes tables as they contain State and County information respectively. You'll also need to create a table to store continent information and join against that table also. Then, you merely have your query match a specific city and connect all your joins.

If you haven't already, I'd recommend looking through their FAQ forum:

http://forum.geonames.org/gforum/forums/show/6.page.

There are posts there detailing importing the data into just about every major database, and also some information about chaining drop down lists.

If you have a more specific question, please post here so we can help.


Blockquote

Download it from here Continent, country , states with reference id

https://www.dropbox.com/sh/496zp6gafuqbcxh/AABfa5xNTQ3uuzxq0UUUpqpaa?dl=0

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号