[OSRM-talk] Add costs on route sections.

Daniel Hofmann hofmann at mapbox.com
Fri Sep 30 10:17:12 UTC 2016


There are two features you could make use of.

1/ The Traffic feature for continuously updating edge weights depending on
live traffic feeds:

https://github.com/Project-OSRM/osrm-backend/wiki/Traffic

For this you need to map from your sensor's location to OSM ids in order to
update edge weights.

2/ The Raster feature: similar to elevation data you can use your sensor's
reading to adapt the cost for routing over certain segments:

https://github.com/Project-OSRM/osrm-backend/wiki/Integrating-third-party-raster-data

Note: at the moment both approaches will change your ETAs until
https://github.com/Project-OSRM/osrm-backend/pull/2399 lands.

If all you want is to discard certain ways where pollution is to high, you
can do this already in the car.lua profile's way_function.
Changes there require re-running the osrm pipeline, but this may be
feasible depending on your region's size and how often you want to change
routes.

Cheers,
Daniel J H

On Fri, Sep 30, 2016 at 3:25 AM, Stephen Woodbridge <woodbri at swoodbridge.com
> wrote:

> Hi Pedro,
>
> The way OSRM works is that you have to prepare the data before generating
> the route. You can probably modify the prepare process by writing additions
> to the LUA scripts it calls. But for large coverage areas the prepare step
> takes a lot of time.
>
> You also mentioned that this is a web based application, so typically all
> web clients have to use the same routing instance which may be ok if you
> application does not expect each web user to be able to have their own
> privately modified graph for routing. For example if the route modification
> is a server process and all web client use the same modified graph then you
> would be ok.
>
> But is each web client can modify the the graph based on their input and
> then expects to solve the graph for a route based on their local
> modifications, you probably don't want to use OSRM, something like
> pgRouting might be more appropriate.
>
> Others on the list can probably offer more detailed suggestions on where
> to look for examples of code to change the graph prepare process. I believe
> some work has been done to support traffic feeds and this sounds like it is
> very similar to that.
>
> -Steve
>
> On 9/29/2016 8:19 PM, Pedro Luiz Cumino wrote:
>
>> Hello all,
>>
>>
>> I'm a new user of the ORSM engine. I can run the basic setup and the
>> server.
>>
>>
>> I'm working in build a route engine for web purpose in order to avoid
>> certain areas.
>>
>>
>> I'm wondering if it's possible to add costs to a certain group of route
>> sections. This costs must be considered during the route
>> calculation. The idea is better explained below:
>>
>>
>> I have the report coming from an external service, which comes as a JSON
>> object. It informs me the location where a sensor is present and must be
>> considered when calculating the route, like a cost to the lane stretch
>> pointed by the latitude and longitude from the sensors JSON object. The
>> sensors classify the region as *high*, *medium* or *low* level of
>> pollution. I need to set this cost to the lane stretch and then compare
>> if it's worthwhile to select the lane stretch where the issue is present
>> or if select another route is a better decision.
>>
>>
>>
>> How open is the route solver service in order to implement this kind of
>> cost over a route? The idea at the end is to select the lower cost route
>> by comparing the issue level, the time travelling and the travelled
>> distance using my own algorithm.
>>
>>
>>
>> The Figures 1 and 2 illustrate what I'm looking for. Figure 1 shows the
>> route A as the best one to be chosen, even with an issue place on it
>> (the issue with the lowest level). The route B is the worst since it has
>> the highest issue level/cost. The route D is possible to reach the end,
>> but the cost would be too high to be chosen, what makes it the worst
>> route. Figure 2 shows the route B as the best route to be chosen because
>> the cost of the issue on B is lower than the cost that the total
>> distance of D represents.
>>
>>
>>
>> Figure 1
>> <https://geonet.esri.com/servlet/JiveServlet/showImage/2-
>> 630854-217931/route-solution.gif>
>>
>>
>>
>> Figure 2
>> <https://geonet.esri.com/servlet/JiveServlet/showImage/2-
>> 630854-217935/route-solution-withBarriers.gif>
>>
>>
>>
>>
>>
>>
>>
>> In summary, I need a way to insert a cost to certain routes (using the
>> information from coming from another service) and then calculate the
>> route considering such costs. At the end, the algorithm to be
>> implemented will consider both issues and route distances.
>>
>>
>> Which files should I modify in order to accomplish it? Where can I find
>> the routing algorithm used by the engine?
>>
>>
>>
>> Thanks in advance!
>>
>>
>> --
>> Atenciosamente,
>> Kind regards,
>>
>> Pedro Luiz Cumino.
>>
>>
>> _______________________________________________
>> OSRM-talk mailing list
>> OSRM-talk at openstreetmap.org
>> https://lists.openstreetmap.org/listinfo/osrm-talk
>>
>>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20160930/cf19d475/attachment-0001.html>


More information about the OSRM-talk mailing list