Osmnx:如何检索作为高速公路一部分的公交车站信息节点的信息?

Osmnx: How to retreive info on bus-stop info node, which is part of a highway?

我还试图显示 OpenStreetMap 公交车站节点 439460636(https://www.openstreetmap.org/node/439460636)的信息,它是高速公路的一部分。

我正在使用 Python3 Osmnx

其他POI都显示完美。只是没有映射为 'amenity' 的那些。 (还有更多例子)

我正在使用 jupyter notebook 进行分析:

import osmnx as ox

# Retrieve POI shelters
place_name = 'Santa Clara, Santa Clara County, California, USA'
shelter = ox.pois_from_place(place_name, amenities=['shelter'])
cols = ['amenity', 'name', 'element_type', 'shelter_type',
       'building', 'network'
        ]
shelter[cols]
cols = ['amenity', 'name','element_type', 'shelter_type',
       'building', 'network'
        ]
shelter[cols].loc[(shelter['shelter_type'] == 'public_transport') ]
# Look bus-stop in highway
graph = ox.graph_from_place(place_name)
nodes, edges = ox.graph_to_gdfs(graph)
nodes.loc[(nodes['highway'] == 'bus_stop') ]

立交桥:

[out:json][timeout:25];
// gather results
(
  area[name="Santa Clara, Santa Clara County, California, USA"];
  node(area)["highway"="bus_stop"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

兴趣点 Kino (439460636) 未列出。列出了 POI 旁边的避难所。兴趣点在我的区域中间,所以我不明白如何检索节点信息。你能帮忙吗?

使用来自 chesterharvey 的 post 中链接的文件手动更新 Osmnx。 https://github.com/gboeing/osmnx/issues/116#issuecomment-439577495 功能的最终测试仍未完成!

import osmnx as ox

# Specify the name that is used to seach for the data
place_name = "Santa Clara, Santa Clara County, California, USA"

tags = {
    'amenity':True,
    'leisure':True,
    'landuse':['retail','commercial'],
    'highway':'bus_stop',
}

all_pois = ox.pois_from_place(place=place_name, tags=tags)
all_pois.loc[(all_pois['highway'] == 'bus_stop')]

我认为你可以用脚印轻松做到这一点:

#point of interests around an aread
import networkx as nx
import osmnx as ox
import requests

#returns polygon or coordinates of poi
#point = (59.912390, 10.750584)
#amn = ["bus_station",'waste_transfer_station'] #["bus_station",'waste_transfer_station']
#points of interest/amenities we can use: https://wiki.openstreetmap.org/wiki/Key:amenity
def get_interest_points(long,lat,dist,amn[]):
    point = (long, lat)
    gdf_points = ox.pois_from_point(point, distance=dist, amenities=amn)
    return gdf_points[["amenity", "geometry"]]

#Get bus buildings, distance in meter 400 is minimum
#returns polygon of building
def get_buildings(long,lat,dist):
    point = (long, lat)
    gdf = ox.footprints.footprints_from_point(point=point, distance=dist,footprint_type='buildings')
    return gdf["geometry"]

#Get bus, tram or subway
#type = "bus" or "tram" or "subway"
#, distance in meter 400 is minimum
#returns polygon of stop
def get_buildings(long,lat,dist,type):
    point = (long, lat)
    gdf = ox.footprints.footprints_from_point(point=point, distance=dist,footprint_type=type)
    return gdf["geometry"]

自 v0.13.0 起,此功能与 OSMnx been added 一样。它将 POIs 模块概括为使用 tags 字典而不是 amenities 列表进行查询。它从所有 POI 函数中删除 amenities 参数。 tags 字典接受 key:value 对形式:

  1. 'tag' : True(使用 bool 检索具有 tag 的所有项目)
  2. 'tag' : 'value'(使用字符串检索 tag = value 的所有项目)
  3. 'tag' : ['value1', 'value2', etc](使用列表检索 tag 等于 value1value2

新的POI查询功能使用示例:

import osmnx as ox
ox.config(use_cache=True, log_console=True)
tags = {'amenity' : True,
        'landuse' : ['retail', 'commercial'],
        'highway' : 'bus_stop'}
gdf = ox.pois_from_place(place='Piedmont, California, USA', tags=tags)