我在 OSMBuilding 中找不到 json 文件

I could not find json file in OSMBuilding

我使用 OSM 建筑制作可点击的建筑。当我点击一座建筑时,我会得到建筑 ID。但是,我无法获取建筑物的高度,因为我无法通过 JSON 文件获取此值。

代码在这里:

var map = new L.Map('map');
map.setView([52.52111, 13.40988], 16, false);
new L.TileLayer('https://{s}.tiles.mapbox.com ...

https://codepen.io/osmbuildings/pen/JdaaRM

总而言之,我想使用 OSM Building 获取建筑物的高度。

身高包含在JSON文件中。

在此处查看此示例:https://b.data.osmbuildings.org/0.2/anonymous/tile/16/35210/21491.json。它包含一个 properties 字段,该字段又包含 heightlevels:

"id": "w24273225",
"type": "Feature",
"properties": {
  "height": 65,
  "levels": 17
},
"geometry": {
  "type": "Polygon",
  "coordinates": [
    [...]
  ]
}

仅当 OSM 中的建筑物实际具有此信息时,才会显示高度和级别信息。并非每个建筑物都是这种情况。