【发布时间】:2020-07-25 11:14:19
【问题描述】:
我尝试用树木绘制地图。这些是 openstreetmap 中的节点,所以我想知道是否可以仅绘制带有节点的地图,它们之间没有边缘?
这是我的代码:
place=['Saint-Egreve,France']
G = ox.graph_from_place(place,retain_all=True,truncate_by_edge=True,simplify=False, network_type='none',infrastructure='node[natural=tree]')
fig, ax = ox.plot_graph(ox.project_graph(G))
返回错误:
Traceback (most recent call last):
File "./test.py", line 102, in <module>
fig, ax = ox.plot_graph(ox.project_graph(G))
File "/home/syl20/.conda/envs/ox/lib/python3.8/site-packages/osmnx/plot.py", line 362, in plot_graph
west, south, east, north = edges.total_bounds
File "/home/syl20/.conda/envs/ox/lib/python3.8/site-packages/pandas/core/generic.py", line 5274, in __getattr__
return object.__getattribute__(self, name)
File "/home/syl20/.conda/envs/ox/lib/python3.8/site-packages/geopandas/base.py", line 523, in total_bounds
return GeometryArray(self.geometry.values).total_bounds
File "/home/syl20/.conda/envs/ox/lib/python3.8/site-packages/pandas/core/generic.py", line 5274, in __getattr__
return object.__getattribute__(self, name)
File "/home/syl20/.conda/envs/ox/lib/python3.8/site-packages/geopandas/geodataframe.py", line 101, in _get_geometry
raise AttributeError(
AttributeError: No geometry data set yet (expected in column 'geometry'.
感谢您的宝贵帮助!
西尔万
【问题讨论】:
标签: python python-3.x osmnx