You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Node ID获取道路名称与maxspeed信息?

通过Node ID获取道路名称与maxspeed属性

要通过Node ID获取对应道路的名称和maxspeed属性,可借助Overpass API实现,以下是具体方法:

经纬度查询参考(已知方法)

若使用经纬度查询道路信息,示例请求如下:

https://overpass-api.de/api/interpreter?data=[out:json];way[maxspeed](around:5.0,36.6870970,-4.4531804);out%20center;

对应的返回结果(包含道路名称、maxspeed等核心属性):

{    
    "version": 0.6,    
    "generator": "Overpass API 0.7.61.5 4133829e",    
    "osm3s": {        
        "timestamp_osm_base": "2023-10-13T14:02:30Z",        
        "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."    
    },    
    "elements": [        
        {            
            "type": "way",            
            "id": 60727865,            
            "center": {                
                "lat": 36.6880970,                
                "lon": -4.4541804            
            },            
            "nodes": [                
                746325927,                
                3650408717,                
                7067178413,                
                3547298108,                
                3650408715,                
                760219855,                
                5245547649,                
                5417047626,                
                3650408712,                
                760219851            
            ],            
            "tags": {                
                "cycleway:right": "shared_lane",                
                "highway": "primary",                
                "lanes": "2",                
                "lit": "yes",                
                "maxspeed": "50",                
                "name": "Avenida Molière",                
                "oneway": "yes",                
                "parking:right:orientation": "diagonal",                
                "sidewalk": "right",                
                "surface": "asphalt"            
            }        
        }    
    ]
}

通过Node ID查询的方法

基础查询语句

先通过Node ID定位目标节点,请求如下:

https://overpass-api.de/api/interpreter?data=[out:json];node(id:5417047626);out;

该查询仅返回节点本身信息,无法直接获取道路的名称和maxspeed属性。

更优查询语句

使用way(bn)语法,直接获取包含目标节点的所有道路(way)及其完整属性:

https://overpass-api.de/api/interpreter?data=[out:json];node(id:5417047626);way(bn);out geom;

此请求会返回包含目标节点的道路详情,其中直接包含所需的name(道路名称)和maxspeed属性。

内容的提问来源于stack exchange,提问作者dlopezgonzalez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 21:32:43