我需要使用 Nominatim 在给定坐标处检索一个城市。所谓城市,是指相关的 OSM 关系/节点及其所有属性,而不仅仅是国家名称(实际上,我真的很关心 osm_id、osm_type、名称和坐标)
编辑:添加上下文
我运行一个平台,用户可以在其中将帖子附加到位置。我使用 OSM 作为主数据库来帮助用户检索地点。创建帖子后,我会在我的业务数据库中引用该位置。我希望能够汇总城市和国家级别的帖子。所以我代表那些有专用表和典型关系的人:地点 n-1 城市 n-1 国家。
目前我知道我可以通过这样的查询获取最大级别的信息(zoom=18):
产生相关信息,包括城市名称:
<reversegeocode timestamp="Thu, 02 Oct 14 15:16:11 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright" querystring="format=xml&accept-language=fr&lat=43.8338&lon=4.3596&zoom=18&addressdetails=1">
<result place_id="6643770" osm_type="node" osm_id="680342651" lat="43.833464" lon="4.3596107">3, Rue de la République, Écusson, La Placette, Nîmes, Nimes, Gard, Languedoc-Roussillon, France métropolitaine, 30000;30900, France</result>
<addressparts>
<house_number>3</house_number>
<road>Rue de la République</road>
<neighbourhood>Écusson</neighbourhood>
<suburb>La Placette</suburb>
<city>Nîmes</city>
<county>Nimes</county>
<state>Languedoc-Roussillon</state>
<country>France</country>
<postcode>30000;30900</postcode>
<country_code>fr</country_code>
</addressparts>
</reversegeocode>
我将城市作为城市标签中的字符串。但是,如果我想获得该城市的 OSM 积分,我必须进行另一个查询:
优化它的最佳方法是什么?
由于我运行自己的 Nominatim 实例,如果这是最好的选择,我可能会选择 SQL,但我必须在 Nominatim 中创建一个新的端点,其中包含所有维护复杂性......
我需要为国家/地区提供相同的功能。
对于国家/地区,我发现参数 zoom=1 无论如何都应该完成这项工作。艰难,城市没有可靠的对应物。