如何获取nominatim地址组件的osm_id?

时间:2017-01-30 13:00:17

标签: openstreetmap nominatim

这是对nominatim的示例请求:

http://nominatim.openstreetmap.org/search?q=milan,%20italy&format=json&addressdetails=1&accept-language=en

这是地址:

"address":{"city":"Milan","county":"Milan","state":"Lombardy","country":"Italy","country_code":"it"}

所有地址组件都有osm_id,我想知道它们,如下所示:

 "address":{"city":["Milan", <milanId>],"county":["Milan",  <milanId>],"state":["Lombardy", <lombardyId>],"country":["Italy", <italyId>]}

我怎样才能得到它们?

1 个答案:

答案 0 :(得分:0)

根据您的使用情况,您可以使用Overpass APIis_in查询。有关米兰的坐标,请参阅example at overpass turbo

[out:json][timeout:25];
is_in(45.4667971,9.1904984);
out;