OSMnx 没有属性 'speed'

OSMnx has no attribute 'speed'

我已经成功下载osmnx 0.14.0版本:

但输出显示 AttributeError: module 'osmnx' has no attribute 'speed'.

我该怎么做才能解决这个问题? 我的 python 版本是 3.8.1

此外,这是代码:

import folium
import pandas as pd 
import numpy as np  
import osmnx as ox
import networkx as nx
import os

ox.config(use_cache=True, log_console=True)

G = ox.graph_from_point((-33.889606, 151.283306), distance=3000, network_type='drive')

G = ox.speed.add_edge_speeds(G)
G = ox.speed.add_edge_travel_times(G)

orig = ox.get_nearest_node(G, (-33.889606, 151.283306))
dest = ox.get_nearest_node(G, (-33.862004, 151.211151))
route = nx.shortest_path(G, orig, dest, 'travel_time')

route_map = ox.plot_route_folium(G, route)
route_map.save('route_333.html')

更新 OSMnx。

  • 使用 pip:pip install -U osmnx
  • 使用康达:conda update osmnx

然后编辑这一行:

G = ox.graph_from_point((-33.889606, 151.283306), distance=3000, network_type='drive')

进入:

G = ox.graph_from_point((-33.889606, 151.283306), dist=3000, network_type='drive')

你得到你的地图: