gboeing / osmnx

OSMnx is a Python package to easily download, model, analyze, and visualize street networks and other geospatial features from OpenStreetMap.
https://osmnx.readthedocs.io
MIT License
4.86k stars 826 forks source link

Misleading Comment in Speed.py #691

Closed Picajoluna closed 3 years ago

Picajoluna commented 3 years ago

Hi,

I was following this guide of yours on creating drive network isochrones (how far one can get in X minutes of driving). We initially tried using the add_edge_speeds() and add_edge_travel_time() functions in speed.py. The isochrone produced however was quite odd and suggested that we could travel multiple km's in only a few seconds.

I believe the comment on line 150 is incorrect:

    # convert distance km to meters, and speed km per hour to km per second
    distance_km = edges["length"] / 1000
    speed_km_sec = edges["speed_kph"] / (60 * 60)

The edge 'length' attribute is actually initially in meters (at least it is in my graph), whereas you're suggesting that it needs a conversion to meters. In reality, by dividing it by 1000, you're converting those meters to km, which then get divided by speed_km_sec.

gboeing commented 3 years ago

Thanks. Would you like to propose a PR to correct this?

gboeing commented 3 years ago

closed by #693