使用Overpass QL 获取 OSM 封闭节点中的所有数据
TL;DR (or write either)
时间紧张,先把方法写在这里,后续再补充背景知识部分。
使用 Overpass QL 的 Area Clauses
根据 Overpass API/Language Guide 对于 Area clauses 的解读,Overpass API server 会周期性地检索构成封闭范围的 way
以及 rel
对象,并据此创建 Area 对象。值得注意的是,这种转换并不是强制性的,因此可能你需要检索的范围并不能直接用 Area clause 作为 Filter。
实例
使用 area clause 获取卡耐基梅隆大学(CMU)校园内的所有数据。
- 首先,在OSM中找到封闭CMU校区的
way
或rel
对象。
在本例中,围起校园范围的是
id=2279034
的rel
对象。根据 Area clauses 的介绍,针对分别由way
和rel
组成的封闭平面,获取其信息的方法是:
(area:2400000001) /* filter objects in area whose surface is delimited by the way with id=1 in OSM */
(area:3600000001) /* filter objects in area whose surface is delimited by ways members of the relation with id=1 in OSM */
即:分别在 way
和 rel
对象的 id
上施加分别为 2400000000
和 3600000000
的偏移量。<