OpenStreetMap数据是否包含欧洲所有地区的英文名称?

huangapple go评论41阅读模式
英文:

Does openstreetmap data contain English names for all of Europe?

问题

我使用来自https://download.geofabrik.de/europe.html的OSM数据,特别关注乌克兰周围的地区。我从pbf下载文件中创建mbtiles(使用tilemaker),并使用一个瓷砖服务器(tileserver-gl)将矢量瓷砖发送到浏览器。

一切都如预期那样运行,但对于乌克兰和大多数周围国家,我无法弄清楚如何更新我的矢量样式(styles.json)以呈现国家、州和城市的英文名称。我尝试在我的样式中在layers[x].layout.text-field中使用'name:en',但是瓷砖就不会以任何名称呈现,所以我认为那个标签是缺失的。

我从OSM网站导出了乌克兰的一个区域,只是为了确认至少对于某些地方使用了'name:en' - 尽管我无法确认城市、州和国家是否也是如此,因为导出工具说该区域太大无法下载。

我想知道是否可能pbf数据不包含英文名称。

有谁知道如何显示英文名称,就像我正在尝试的那样吗?

英文:

I'm using OSM data from https://download.geofabrik.de/europe.html, and especially focused on areas around Ukraine. I'm creating mbtiles from the pbf downloads (using tilemaker) and using a tileserver (tileserver-gl) to send vector tiles to the browser.

All works as expected, but for Ukraine and most surrounding countries, i can't figure out how to update my vector styles (styles.json) to render the English name for the country, state, and city. I've tried using 'name:en' in layers[x].layout.text-field in my styles, but the tiles then don't render with a name at all, so i assume that tag is missing.

I'm exported an area in Ukraine from the OSM website, just to confirm that 'name:en' is used, at least for some places - altho i can't confirm this for the city, state, country because the export tool says the area is too large to download.

I'm wondering if it's possible that the pbf data doesn't contain the English names.

Does anyone know how to show English names, like I'm trying to do?

答案1

得分: 1

我在想这是否可能,PBF 数据不包含英文名称。

你可以自己查看,使用 Osmium 工具:你可以检查 PBF 文件,看看你感兴趣的要素是否存在 'name:en' 标签。使用 标签过滤

osmium tags-filter rome.osm.pbf n/name \
    -o names-in-rome.osm.pbf

很可能你正在使用的 OpenStreetMap(OSM)数据并不包含你感兴趣要素的英文名称。OSM 数据由志愿者贡献,特定要素的英文名称的可用性可能不一致,特别是在非英语地区。

你应该考虑采用默认的 'name' 标签:在你的 styles.json 文件中,你可以使用回退机制,如果 'name:en' 标签不可用,则显示默认的 'name' 标签。你可以在 text-field 属性中使用 ["coalesce", ["get", "name:en"], ["get", "name"]] 表达式:

{
  "layout": {
    "text-field": ["coalesce", ["get", "name:en"], ["get", "name"]]
  }
}

这样,如果 'name:en' 标签丢失,将使用默认的 'name' 标签。参见 coalesce 这里的使用示例

英文:

> I'm wondering if it is possible that the pbf data does not contain the English names.

You can have a look for yourself, with the Osmium Tool: you can inspect the PBF file and see if the 'name:en' tag is present for the features you are interested in. Use tag filtering

osmium tags-filter rome.osm.pbf n/name \
    -o names-in-rome.osm.pbf

It is likely that the OpenStreetMap (OSM) data you are using does not contain English names for all the features you are interested in. OSM data is contributed by volunteers, and the availability of English names for certain features might be inconsistent, especially in non-English speaking regions.

You should consider falling to the default 'name' tag: In your styles.json file, you can use a fallback mechanism to display the default 'name' tag if the 'name:en' tag is not available. You can do this using the ["coalesce", ["get", "name:en"], ["get", "name"]] expression in your text-field property:

{
  "layout": {
    "text-field": ["coalesce", ["get", "name:en"], ["get", "name"]]
  }
}

This way, if the 'name:en' tag is missing, the default 'name' tag will be used instead.
See coalesce use here as an example.

huangapple
  • 本文由 发表于 2023年6月6日 02:22:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76409069.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定