<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">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>