4

我还试图显示作为高速公路一部分的OpenStreetMap 巴士站节点 439460636 ( https://www.openstreetmap.org/node/439460636 ) 的信息。

我正在使用 Python3 Osmnx

其他 POI 都显示完美。只是不是那些没有被映射为“便利设施”的人。(还有更多例子)

我正在使用 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;

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

4

3 回答 3

3

使用 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')]
于 2019-04-24T15:58:07.787 回答
1

从 v0.13.0 开始,此功能已添加到 OSMnx。它将 POI 模块概括为使用tags字典而不是amenities列表进行查询。它从所有 POI 函数中删除amenities参数。dict 接受以下形式的tags键:值对:

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

新增兴趣点查询功能使用示例:

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)
于 2020-05-14T01:17:59.453 回答
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"]
于 2020-03-19T17:46:11.243 回答