conda-forge / osmnx-feedstock

A conda-smithy repository for osmnx.
BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

float division by zero #37

Closed YATPKU closed 5 years ago

YATPKU commented 5 years ago

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!

ocefpaf commented 5 years ago

I am a beginner at python and osmnx. Any advice, please? I really appreciate!

This is a packaging community and we are not the authors of osmnx. Please raise this issue upstream:

https://github.com/gboeing/osmnx/issues