我还尝试显示OpenStreetMap公交车站节点439460636(https://www.openstreetmap.org/node/439460636)的信息,该节点是高速公路的一部分。
我正在使用Python3 Osmnx
其他POI都能完美显示。只是不是那些没有被映射为“便利设施”的地方。 (还有更多示例)
我正在使用jupyter笔记本进行分析:
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;
未列出POI Kino (439460636)
。列出了POI旁边的避难所。 POI位于我区域的中间,所以我不明白如何获取节点信息。你能帮忙吗?
答案 0 :(得分:2)
使用chesterharvey中此文章中链接的文件手动更新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')]
答案 1 :(得分:1)
此功能自v0.13.0起为OSMnx的been added。它将POIs模块推广为使用tags
字典而不是amenities
列表进行查询。它从所有POI函数中删除amenities
参数。 tags
字典接受以下形式的key:value对:
tag
的所有项目)tag
= value
的所有项目)tag
等于value1
或value2
等的所有项目。新的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)
答案 2 :(得分:0)
您可以轻松做到这一点,我认为:
#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"]