[英]Grouped nodes in OpenStreetMap with Overpass API
Hy.I would like to query nodes gruped by some area. Hy.I想查询某些区域的节点。 For example: how to get all nodes (eg peaks) for given area (eg. administrative boundary - country).
例如:如何获得给定区域的所有节点(例如峰值)(例如,行政边界 - 国家)。
Something like join in SQL: SELECT n.*, a.name from node n LEFT JOIN area a ON n.area_id = a.id WHERE n.type = "peak" 类似于加入SQL:SELECT n。*,a.name from node n LEFT JOIN area a ON n.area_id = a.id WHERE n.type =“peak”
Resoult would be something like: Resoult会是这样的:
{ features: [
{
type: "node:",
area: "slovenia"
properties: {....},
geometry: {...}
},
...
]}
or maybe: 或者可能:
{ areas: [
slovenia: {
nodes: [
{
type: "node:",
area: "slovenia"
properties: {...},
geometry: {...}
},
...
]
},
...
]}
Is this even possible? 这甚至可能吗? Or should I first make 1 query for all areas and then for each area make another query?
或者我应该首先对所有区域进行1次查询,然后为每个区域进行另一次查询?
Area in area support is not yet officially available (see this Github pull request for some ideas how this might look like in the future), but you could use the approach described on the following help page: 区域支持区域尚未正式提供(请参阅此Github请求了解将来可能会出现的一些想法),但您可以使用以下帮助页面中描述的方法:
https://help.openstreetmap.org/questions/35976/add-reverse-geocoding-information-to-the-overpass-resulting-set https://help.openstreetmap.org/questions/35976/add-reverse-geocoding-information-to-the-overpass-resulting-set
In particular I'd recommend to take a look at the following query: http://overpass-turbo.eu/s/4FJ 特别是我建议看看以下查询: http : //overpass-turbo.eu/s/4FJ
It works with a single query but mixes sign posts with all areas this sign post is included.You should be able to easily adjust this to your tags / area. 它适用于单个查询,但会将标志帖与所有区域混合使用此标志帖。您应该能够轻松地将其调整为您的标签/区域。 Note that a bit of post processing on the result may be required.
请注意,可能需要对结果进行一些后处理。
Probably the closest thing you're looking for is also described in the Github pull request . 可能你正在寻找的最接近的东西也在Github拉取请求中描述。 This would print the area followed by all nodes in that area.
这将打印该区域中所有节点后面的区域。 But as I mentioned, this will only be available at some point in the future.
但正如我所提到的,这只会在将来某个时候出现。
Sample output: 样本输出:
@oname @id name
area 3600062387 Landkreis Merzig-Wadern
node 313138635
node 313150002
node 313460474
node 315050154
node 431311279
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.