pgRouting / osm2pgrouting

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

2.1.0 cost/reverse_cost not set correctly for oneway streets #128

Closed woodbri closed 8 years ago

woodbri commented 8 years ago

using This is osm2pgrouting Version 2.1, I just noticed that cost and reverse_cost values are NOT set to 1000000 for the wrong way on one_way streets. The same for cost_s and reverse_cost_s. In fact it is even worse than that because the reverse_cost for one_way=1 are negative values which might be ok if the algorithm eliminates these edges, but when one_way in (0,2) both values are positive.

417;102;0.000577722511245135;497.286624538597;"";16329;5454;-71.3205203;42.6074975;-71.32002;42.6077864;0.000577722511245135;-0.000577722511245135;13.8135173482944;-13.8135173482944;"";1;130;130;8888815;64835130;64910422;1;""
436;112;0.00198361736734031;165.789685892489;"Saratoga Street";3266;11195;-71.3019915;42.6186827;-71.3000534;42.6191052;0.00198361736734031;-0.00198361736734031;12.7530527609607;-12.7530527609607;"";1;50;50;8888881;64931814;64894445;2.5;""
461;102;0.000561720330772339;57.4187938952264;"";11650;13358;-71.3281444;42.6132963;-71.3284706;42.6137536;0.000561720330772339;-0.000561720330772339;2.39244974563443;-2.39244974563443;"";1;88;88;8888835;64929542;64926257;1;""
474;108;0.000458349920919023;38.2496018886591;"Merrimack Street";11803;15493;-71.307384;42.645424;-71.3078351;42.6455052;0.000458349920919023;0.000458349920919023;1.52998407554636;1.52998407554636;"";2;90;90;8888850;64910689;1236794932;1.5;""
475;108;0.000507758259406249;41.8497802544357;"Merrimack Street";15493;13171;-71.3078351;42.6455052;-71.30834;42.645559;0.000507758259406249;0.000507758259406249;1.67399121017743;1.67399121017743;"";2;90;90;8888850;1236794932;64855170;1.5;""
476;108;0.000922436447669103;75.8136535115301;"Merrimack Street";13171;11790;-71.30834;42.645559;-71.30926;42.645626;0.000922436447669103;0.000922436447669103;3.03254614046121;3.03254614046121;"";2;90;90;8888850;64855170;64820931;1.5;""
cvvergara commented 8 years ago

If you intend to use the values an algorithm that don't correctly creates the directed/undirected graph based on the fct that negative values are not inserted, then you can modify the generated negative values (the edge does not exist) to be highly costly.

woodbri commented 8 years ago

There is clearly a bug here because the software does not behave the same way for one_way=1 vs. one_way=2.

I presume one_way =0, both ways ok, =1 from-to is ok, =2 to-from is ok. But I could not find where this is documented.

cvvergara commented 8 years ago

Probably the documentation made by GSoc Student is incomplete

     " one_way int, " 
 -1 reversed (1 way but geometry is reversed)
 0   unknown,
 1   yes(normal direction),
 2   not one way its 2 way,
 3 - reversible (one way street but direction changes on time)

0 & 2 & 3 put positive values on all cost /reverse_cost -1 has negative value on cost column 1 has negative value on reverse_cost column