<div dir="ltr"><div><span id="m_-275766364094620262mt-composer-id__1586918345737-0"></span>Thank you for your reply! I analyzed the full JSON response using the "steps" parameter to check individual weight values for each edge. It looks like the weights are dependent on the duration value calculated. I did not specify how to calculate the duration value at all and assumed its the length/max_speed as given in OSM data. I also didn't specify any relationship between the duration and BPR. "BPR" is just another pre-calculated edge attribute like "max speed" in OSM.</div><div><br></div><div><div><div>This is what is happening right now:</div><div><br></div><div>I used OSMnx to see the edge attributes for a particular road:</div><div><pre>{'osmid': 536661786,
 'oneway': True,
 'name': 'Tampines Avenue 1',
 'highway': 'secondary',
 'maxspeed': '60.0',
 'length': 16.847,
 'travel_time': '1.01082',
 'Location': '(1.3501839, 103.926145, 1.3502606, 103.9261452)',
 'BPR': 1.0297525963481398}<br><br></pre><pre><font face="arial,sans-serif">I then used OSRM for the same road:<br><br>{'intersections': [{'out': 3,
         'location': [103.926145, 1.350184],
       'mode': 'driving',
       'duration': 3.5,
       'weight': 3.2,
       'distance': 16.8,
       'name': 'Tampines Avenue 1'}<br><br></font></pre><pre><font face="arial,sans-serif">Duration != travel_time and BPR != weight by a huge margin. How is this being calculated? </font></pre></div></div></div><div>I just want to make sure I wrote my profile correctly. <br></div><div><ol><li>Even if turn penalties or traffic light penalties were added to my weights, the cumulative weight value should've been higher than duration.<br> </li><li>I saw weight customizations in a `way_function` in the testbot.lua examples. Should I be using this function to customize my weights?</li><li>How do I make the algorithm use the readily available weights given in my OSM data and not be dependent on duration calculated?  <br></li></ol><div><br></div><div>Thanking you in advance,</div><div>Niharika<br></div><div></div></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 14, 2020 at 9:47 PM Daniel Patterson via OSRM-talk <<a href="mailto:osrm-talk@openstreetmap.org" target="_blank">osrm-talk@openstreetmap.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I would say that the first thing to do to diagnose the problem is to find the shortest possible path (fewest edges) that exhibit this problem for you.</div><div><br></div><div>At first glance, I'd say that your BPR values aren't what you think they are somewhere along your route, but it's impossible to say exactly where they might be incorrect.</div><div><br></div><div>daniel<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 14, 2020 at 2:39 AM Niharika Shrivastava <<a href="mailto:chunnushrivastava@gmail.com" target="_blank">chunnushrivastava@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello, I'm new to OSRM and I went through previous issues and couldn't find much related to this, hence posting it here.<br><br>I had used a python library OSMnx to extract Singapore's data and changed certain edge attributes for it. I calculated an edge attribute `"BPR"` (float) and stored it in the graph (This is travel time in case of real traffic data). I then converted this modified graph into a shapefile and then converted the shapefile into OSM XML using JOSM. I fed this to OSRM in order to use CH. I want to find the shortest route between two points wherein my weights (or cost) are the BPR value I had calculated. I understand I have to specify that in the car profile. This is how I specified it:<br><br>```<br>function setup()<br>  return {<br>    properties = {<br>      ...<br>      weight_name                = 'congestion',<br>      ...<br>    },<br>  ...<br>}<br><br><br>function process_way(profile, way, result, relations)<br>  local data = {<br>    -- prefetch tags<br>    ...<br>    BPR = way:get_value_by_key('BPR')<br>  }<br>     <br>  result.weight = data.BPR<br>  ...<br>}<br>```<br><br>This is the JSON response I get for a certain query:<br>```<br>{'code': 'Ok',<br> 'routes': [{'geometry': 's}gG{ijyReEnNdm@|Wpl@~}@b\\lfAw\\twAbFjt@wM`ZwSpAGnNgN|Dvm@fWwHhb@bErz@qFxeAzVfkAfr@b{Ak_@rr@ocA~dAgCda@ji@dz@`j@di@`Sfi@PfQcRpc@ySyCgw@~XjEx]dHDkEl\\ju@lf@ii@n}@oVqEiKlR_Elw@bJd[lc@wFdKf[',<br>   'legs': [{'steps': [],<br>     'distance': 32298.2,<br>     'duration': 2308.4,<br>     'summary': '',<br>     'weight': 2179.6}],<br>   'distance': 32298.2,<br>   'duration': 2308.4,<br>   'weight_name': 'congestion',<br>   'weight': 2179.6}],<br> 'waypoints': [{'hint': 'YwYBgG8GAYALAAAAAQAAAAAAAAAAAAAAHN-XQWpx4j0AAAAAAAAAAA0AAAABAAAAAAAAAAAAAAAJAAAAyOIxBiSzFADI4jEGJLMUAAAAzwFqJcKJ',<br>   'distance': 0,<br>   'name': 'Tampines Avenue 8',<br>   'location': [103.932616, 1.35658]},<br>  {'hint': 'EAYBgBcGAYAUAAAAAAAAAAAAAAAAAAAAPzfZQQAAAAAAAAAAAAAAABkAAAAAAAAAAAAAAAAAAAAJAAAA6oIuBlR3FADqgi4GVHcUAAAALwpqJcKJ',<br>   'distance': 0,<br>   'name': 'Boon Lay Drive',<br>   'location': [103.711466, 1.341268]}]}<br>```<br><br>Looking at this part from the JSON:<br> ```<br> 'duration': 2308.4,<br>  'weight': 2179.6}],<br>```<br><div>As I understand, weight is the summation of BPR values for each edge.  Duration is estimated free flow time:` length/max_speed for each edge`. The `value of weight should be >= duration` which is true when I use Dijkstra for routing using edge weights as BPR value (`3155.27`). But over here, thats not the case. <br></div><div><br></div><div>BPR = duration*(some delay based on traffic) >= duration in case of no traffic<br></div><br>Can someone please point out if my Profile is wrongly written or if I've missed any steps?</div>
_______________________________________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
</blockquote></div>
_______________________________________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
</blockquote></div>