pgRouting / osm2pgrouting

Import tool for OpenStreetMap data to pgRouting database
https://pgrouting.org
GNU General Public License v2.0
291 stars 111 forks source link

How is the cost_s/maxspeed_forward column calculated #163

Closed Stophface closed 7 years ago

Stophface commented 7 years ago

I have two questions regarding the rules the columns in the ways table are created

  1. How is the cost_s column in osm2pgrouting is calculated? Are that seconds? Seconds of what? Is it the traveltime and the speed to calculate the traveltime is used from maxspeed_forward

  2. How does osm2pgrouting create the maxspeed_forward column in the ways table? 2.1 Is the number extracted from the key:maxspeed https://wiki.openstreetmap.org/wiki/Key:maxspeed ? 2.2 How does it treat different units (mph and kmh). 2.3 If there is no value in key:maxspeed, what numbers/value will it insert?

cvvergara commented 7 years ago

1.1) https://github.com/pgRouting/osm2pgrouting/blob/master/src/Export2DB.cpp#L460 1.2) _s is for seconds

2.1) yes, if it exists otherwise uses the default value of maxspeed in the configuration file you are using 2.2) by converting to km/hr: https://github.com/pgRouting/osm2pgrouting/blob/master/src/Way.cpp#L248 2.3) the default value of maxspeed in the configuration file you are using

Stophface commented 7 years ago

Awesome, thanks. Unfortunately my C++ is not good enough to derive these information from the code. Thats why I asked here. Would be nice to have that on the docs somewhere.