【发布时间】:2020-12-02 18:27:20
【问题描述】:
关于从 osmnx 网络中删除边的问题。
我写了下面的代码,用下面的例子来分析。 例如:https://github.com/gboeing/osmnx-examples/blob/master/notebooks/13-isolines-isochrones.ipynb
我的代码
import geopandas as gpd
import matplotlib.pyplot as plt
import networkx as nx
import osmnx as ox
from descartes import PolygonPatch
from shapely.geometry import Point, LineString, Polygon
%matplotlib inline
ox.config(log_console=True, use_cache=True)
point = 35.334023, 129.314150
network_type = 'drive'
trip_times = [10, 20, 30, 40] #in minutes
travel_speed = 20 #walking speed in km/hour
# download the street network
G = ox.graph_from_point(point, network_type='drive', dist=8000)
ox.plot_graph(G, node_size=1, edge_color='#999999', node_color='#dc4343', edge_linewidth=0.5, figsize=(15, 20))
在这里,我想从配置的网络中删除特定的边缘。 例如
edges = edges.loc[edges['name'].str.contains("천산로")==False]
还没有解决这些问题。如果您能给我一个好的答案,我将不胜感激。
【问题讨论】:
-
我建议您阅读 OSMnx 文档,尤其是 NetworkX 文档,因为从图中删除边是基本功能。