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.

This is what is happening right now:

I used OSMnx to see the edge attributes for a particular road:

{'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}

I then used OSRM for the same road:

{'intersections': [{'out': 3,
         'location': [103.926145, 1.350184],
       'mode': 'driving',
       'duration': 3.5,
       'weight': 3.2,
       'distance': 16.8,
       'name': 'Tampines Avenue 1'}

Duration != travel_time and BPR != weight by a huge margin. How is
this being calculated?

I just want to make sure I wrote my profile correctly.

   1. Even if turn penalties or traffic light penalties were added to my
   weights, the cumulative weight value should've been higher than duration.
   2. I saw weight customizations in a `way_function` in the testbot.lua
   examples. Should I be using this function to customize my weights?
   3. How do I make the algorithm use the readily available weights given
   in my OSM data and not be dependent on duration calculated?


Thanking you in advance,
Niharika


On Tue, Apr 14, 2020 at 9:47 PM Daniel Patterson via OSRM-talk <
osrm-talk@openstreetmap.org> wrote:

> 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.
>
> 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.
>
> daniel
>
> On Tue, Apr 14, 2020 at 2:39 AM Niharika Shrivastava <
> chunnushrivast...@gmail.com> wrote:
>
>> Hello, I'm new to OSRM and I went through previous issues and couldn't
>> find much related to this, hence posting it here.
>>
>> 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:
>>
>> ```
>> function setup()
>>   return {
>>     properties = {
>>       ...
>>       weight_name     = 'congestion',
>>       ...
>>     },
>>   ...
>> }
>>
>>
>> function process_way(profile, way, result, relations)
>>   local data = {
>>     -- prefetch tags
>>     ...
>>     BPR = way:get_value_by_key('BPR')
>>   }
>>
>>   result.weight = data.BPR
>>   ...
>> }
>> ```
>>
>> This is the JSON response I get for a certain query:
>> ```
>> {'code': 'Ok',
>>  '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
>> [',
>>    'legs': [{'steps': [],
>>      'distance': 32298.2,
>>      'duration': 2308.4,
>>      'summary': '',
>>      'weight': 2179.6}],
>>    'distance': 32298.2,
>>    'duration': 2308.4,
>>    'weight_name': 'congestion',
>>    'weight': 2179.6}],
>>  'waypoints': [{'hint':
>> 'YwYBgG8GAYALAAAAAQAAAAAAAAAAAAAAHN-XQWpx4j0AAAAAAAAAAA0AAAABAAAAAAAAAAAAAAAJAAAAyOIxBiSzFADI4jEGJLMUAAAAzwFqJcKJ',
>>    'distance': 0,
>>    'name': 'Tampines Avenue 8',
>>    'location': [103.932616, 1.35658]},
>>   {'hint':
>> 'EAYBgBcGAYAUAAAAAAAAAAAAAAAAAAAAPzfZQQAAAAAAAAAAAAAAABkAAAAAAAAAAAAAAAAAAAAJAAAA6oIuBlR3FADqgi4GVHcUAAAALwpqJcKJ',
>>    'distance': 0,
>>    'name': 'Boon Lay Drive',
>>    'location': [103.711466, 1.341268]}]}
>> ```
>>
>> Looking at this part from the JSON:
>>  ```
>>  'duration': 2308.4,
>>   'weight': 2179.6}],
>> ```
>> 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.
>>
>> BPR = duration*(some delay based on traffic) >= duration in case of no
>> traffic
>>
>> Can someone please point out if my Profile is wrongly written or if I've
>> missed any steps?
>> _______________________________________________
>> OSRM-talk mailing list
>> OSRM-talk@openstreetmap.org
>> https://lists.openstreetmap.org/listinfo/osrm-talk
>>
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
_______________________________________________
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk

Reply via email to