简体   繁体   English

OSM API 立交桥

[英]OSM API Overpass

I am trying to pull all glaciers as entered in OSM in a given country but am noticing that I am only pulling a fraction of what is available.我正在尝试拉动在给定国家/地区输入 OSM 的所有冰川,但我注意到我只拉动了可用冰川的一小部分。 For example, when I run this following code:例如,当我运行以下代码时:

import overpass from shapely.geometry 
import shape, Polygon
api = overpass.API()
api = overpass.API(endpoint="https://overpass.myserver/interpreter")
api = overpass.API(timeout=600)
query = 'area["ISO3166-1"="IS][admin_level=2];(way["natural"="glacier"](area););'
result = api.get(query, verbosity='geom')
import geopandas
results = geopandas.GeoDataFrame.from_features(result['features'])

The result has 132 features and appears as so:结果有 132 个特征,如下所示:

Iceland Glaciers冰岛冰川

I know this is missing one large glacier (Vatnajökull) which does appear in OSM under osm id 406429.我知道这缺少一个大型冰川(Vatnajökull),它确实出现在 OSM 中的 osm id 406429 下。

Any thoughts as to why this is not appearing as a result from my query?关于为什么我的查询没有出现这种情况的任何想法?

OSM Wiki tag documentation is a helpful starting point when writing Overpass queries.在编写 Overpass 查询时,OSM Wiki 标记文档是一个有用的起点。 Here is the documentation for natural=glacier .这是natural=glacier的文档。 The tag/value is applied to nodes and closed ways based on the documentation and also appears to apply to relations based on community preference (even though this is discouraged in the documentation).标签/值基于文档应用于节点和封闭方式,并且似乎也应用于基于社区偏好的关系(即使在文档中不鼓励这样做)。

To query for nodes, ways, and relations, you can use the abbreviation nwr instead of the union (node[natural=glacier];way[natural=glacier];relation[natural=glacier];);要查询节点、方式和关系,可以使用缩写nwr代替 union (node[natural=glacier];way[natural=glacier];relation[natural=glacier];); . . As a side note, you can drop admin_level=2 since ISO3166-1 codes are unique identifiers.作为旁注,您可以删除admin_level=2因为 ISO3166-1 代码是唯一标识符。

Here is the Python request:这是 Python 请求:

query = 'area["ISO3166-1"="IS"];nwr[natural=glacier](area);out geom;'
response = api.get(query)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM