Hello!
I had an error with shapely polygon or multipolygon, but it worked when I changed from place to address. In a next step, it failed when I put the address, so I changed to the place and it worked.
place = 'Phnom Penh, Cambodia'
gdf = ox.gdf_from_place(place)
area = ox.project_gdf(gdf).unary_union.area
G = ox.graph_from_place(place, which_result=2, network_type='drive_service')
calculate basic and extended network stats, merge them together, and display
stats = ox.basic_stats(G, area=area)
extended_stats = ox.extended_stats(G, ecc=True, bc=True, cc=True)
for key, value in extended_stats.items():
stats[key] = value
pd.Series(stats)
However, coming to the next step, it showed another error:
----> 2 stats = ox.basic_stats(G, area=area)
3 extended_stats = ox.extended_stats(G, ecc=True, bc=True, cc=True)
4 for key, value in extended_stats.items():
5 stats[key] = value
c:\anaconda3\envs\osmnx\lib\site-packages\osmnx\stats.py in basic_stats(G, area, clean_intersects, tolerance, circuity_dist)
154
155 # calculate node density as nodes per sq km
--> 156 node_density_km = n / area_km
157
158 # calculate intersection density as nodes with >1 street emanating from
ZeroDivisionError: float division by zero
I am a beginner at python and osmnx. Any advice, please? I really appreciate!
Hello! I had an error with shapely polygon or multipolygon, but it worked when I changed from place to address. In a next step, it failed when I put the address, so I changed to the place and it worked.
stats = ox.basic_stats(ox.graph_from_address('11.568271,104.9224426')) stats['circuity_avg'] 1.036148445103483
place = 'Phnom Penh, Cambodia' gdf = ox.gdf_from_place(place) area = ox.project_gdf(gdf).unary_union.area G = ox.graph_from_place(place, which_result=2, network_type='drive_service') calculate basic and extended network stats, merge them together, and display
stats = ox.basic_stats(G, area=area) extended_stats = ox.extended_stats(G, ecc=True, bc=True, cc=True) for key, value in extended_stats.items(): stats[key] = value pd.Series(stats)
However, coming to the next step, it showed another error:
ZeroDivisionError Traceback (most recent call last)
----> 2 stats = ox.basic_stats(G, area=area) 3 extended_stats = ox.extended_stats(G, ecc=True, bc=True, cc=True) 4 for key, value in extended_stats.items(): 5 stats[key] = value
c:\anaconda3\envs\osmnx\lib\site-packages\osmnx\stats.py in basic_stats(G, area, clean_intersects, tolerance, circuity_dist) 154 155 # calculate node density as nodes per sq km --> 156 node_density_km = n / area_km 157 158 # calculate intersection density as nodes with >1 street emanating from
ZeroDivisionError: float division by zero
I am a beginner at python and osmnx. Any advice, please? I really appreciate!