我尝试以下代码:
G = ox.graph_from_place('Greater London, UK', network_type='walk')
但它不断给出以下错误:
ConnectionError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?format=json&limit=1&dedupe=0&polygon_geojson=1&q=Greater+London%2C+UK (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f50301d5470>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
有人知道这个错误吗?还有一种方法可以从边和节点在 osmnx 中构造一个图形吗?从以下代码:
G = ox.gdfs_to_graph(london_nodes, london_edges)
我还不断收到以下错误:
~/miniconda3/lib/python3.6/site-packages/osmnx/save_load.py in gdfs_to_graph(gdf_nodes, gdf_edges)
600 G = nx.MultiDiGraph()
601 G.graph['crs'] = gdf_nodes.crs
--> 602 G.graph['name'] = gdf_nodes.gdf_name.rstrip('_nodes')
603
604 # add the nodes and their attributes to the graph
~/miniconda3/lib/python3.6/site-packages/pandas/core/generic.py in __getattr__(self, name)
4374 if self._info_axis._can_hold_identifiers_and_holds_name(name):
4375 return self[name]
-> 4376 return object.__getattribute__(self, name)
4377
4378 def __setattr__(self, name, value):
AttributeError: 'GeoDataFrame' object has no attribute 'gdf_name'
节点之前已保存为:
london_nodes = ox.save_load.graph_to_gdfs(G, nodes=True, edges=False)
和边缘为:
london_edges = ox.save_load.graph_to_gdfs(G, nodes=False, edges=True)
提前致谢。