地理名称-Admin3和Admin4数据

时间:2019-01-20 14:39:36

标签: geonames

我已经下载了geonames data dump

主表具有admin3和admin4列,但没有与这些列中的数据相对应的数据转储。

有人知道如何用各自的地名映射admin3和admin4代码吗?

1 个答案:

答案 0 :(得分:1)

主要网站上的文档似乎并不能解释这一点,但是您可以从这里找到

select  t4.name as town,
        t3.name as county, 
        t2.name as district, 
        t1.name as admin1, 
        t0.name, 
        t0.feature_class, 
        t0.feature_code,
        t0.country_code,
        t0.admin1,
        t0.admin2,
        t0.admin3,
        t0.admin4,
        t0.population
from geoname t0
left join geoname t1 on t1.admin1 = t0.admin1 and t1.feature_code = 'ADM1'
left join geoname t2 on t2.admin2 = t0.admin2 and t2.feature_code = 'ADM2'
left join geoname t3 on t3.admin3 = t0.admin3 and t3.feature_code = 'ADM3'
left join geoname t4 on t4.admin4 = t0.admin4 and t4.feature_code = 'ADM4'
where t0.name = 'London'