<div dir="ltr"><div><div>There are two features you could make use of.<br><br></div><div>1/ The Traffic feature for continuously updating edge weights depending on live traffic feeds: <br></div><div><br><a href="https://github.com/Project-OSRM/osrm-backend/wiki/Traffic">https://github.com/Project-OSRM/osrm-backend/wiki/Traffic</a><br><br></div>For this you need to map from your sensor's location to OSM ids in order to update edge weights.<br><br></div>2/ The Raster feature: similar to elevation data you can use your sensor's reading to adapt the cost for routing over certain segments:<br><br><div><a href="https://github.com/Project-OSRM/osrm-backend/wiki/Integrating-third-party-raster-data">https://github.com/Project-OSRM/osrm-backend/wiki/Integrating-third-party-raster-data</a><br><br></div><div>Note: at the moment both approaches will change your ETAs until <a href="https://github.com/Project-OSRM/osrm-backend/pull/2399">https://github.com/Project-OSRM/osrm-backend/pull/2399</a> lands.<br><br></div><div>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.<br>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.<br><br></div><div>Cheers,<br></div><div>Daniel J H<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 30, 2016 at 3:25 AM, Stephen Woodbridge <span dir="ltr"><<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Pedro,<br>
<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
-Steve<span class=""><br>
<br>
On 9/29/2016 8:19 PM, Pedro Luiz Cumino wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Hello all,<br>
<br>
<br>
I'm a new user of the ORSM engine. I can run the basic setup and the server.<br>
<br>
<br>
I'm working in build a route engine for web purpose in order to avoid<br>
certain areas.<br>
<br>
<br>
I'm wondering if it's possible to add costs to a certain group of route<br>
sections. This costs must be considered during the route<br>
calculation. The idea is better explained below:<br>
<br>
<br>
I have the report coming from an external service, which comes as a JSON<br>
object. It informs me the location where a sensor is present and must be<br>
considered when calculating the route, like a cost to the lane stretch<br>
pointed by the latitude and longitude from the sensors JSON object. The<br></span>
sensors classify the region as *high*, *medium* or *low* level of<span class=""><br>
pollution. I need to set this cost to the lane stretch and then compare<br>
if it's worthwhile to select the lane stretch where the issue is present<br>
or if select another route is a better decision.<br>
<br>
<br>
<br>
How open is the route solver service in order to implement this kind of<br>
cost over a route? The idea at the end is to select the lower cost route<br>
by comparing the issue level, the time travelling and the travelled<br>
distance using my own algorithm.<br>
<br>
<br>
<br>
The Figures 1 and 2 illustrate what I'm looking for. Figure 1 shows the<br>
route A as the best one to be chosen, even with an issue place on it<br>
(the issue with the lowest level). The route B is the worst since it has<br>
the highest issue level/cost. The route D is possible to reach the end,<br>
but the cost would be too high to be chosen, what makes it the worst<br>
route. Figure 2 shows the route B as the best route to be chosen because<br>
the cost of the issue on B is lower than the cost that the total<br>
distance of D represents.<br>
<br>
<br>
<br>
Figure 1<br></span>
<<a href="https://geonet.esri.com/servlet/JiveServlet/showImage/2-630854-217931/route-solution.gif" rel="noreferrer" target="_blank">https://geonet.esri.com/servl<wbr>et/JiveServlet/showImage/2-<wbr>630854-217931/route-solution.<wbr>gif</a>><br>
<br>
<br>
<br>
Figure 2<br>
<<a href="https://geonet.esri.com/servlet/JiveServlet/showImage/2-630854-217935/route-solution-withBarriers.gif" rel="noreferrer" target="_blank">https://geonet.esri.com/servl<wbr>et/JiveServlet/showImage/2-<wbr>630854-217935/route-solution-<wbr>withBarriers.gif</a>><span class=""><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
In summary, I need a way to insert a cost to certain routes (using the<br>
information from coming from another service) and then calculate the<br>
route considering such costs. At the end, the algorithm to be<br>
implemented will consider both issues and route distances.<br>
<br>
<br>
Which files should I modify in order to accomplish it? Where can I find<br>
the routing algorithm used by the engine?<br>
<br>
<br>
<br>
Thanks in advance!<br>
<br>
<br>
--<br>
Atenciosamente,<br>
Kind regards,<br>
<br>
Pedro Luiz Cumino.<br>
<br>
<br></span>
______________________________<wbr>_________________<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.or<wbr>g/listinfo/osrm-talk</a><br>
<br>
</blockquote>
<br>
<br>
---<br>
This email has been checked for viruses by Avast antivirus software.<br>
<a href="https://www.avast.com/antivirus" rel="noreferrer" target="_blank">https://www.avast.com/antiviru<wbr>s</a><br>
<br>
<br>
______________________________<wbr>_________________<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.or<wbr>g/listinfo/osrm-talk</a><br>
</blockquote></div><br></div>