<div dir="ltr"><div>1/ using the Traffic feature you can only update <code>(from_osm_id, to_osm_id, edge_speed_in_km_h) tuples:</code><br><br></div><div><a href="https://github.com/Project-OSRM/osrm-backend/wiki/Traffic">https://github.com/Project-OSRM/osrm-backend/wiki/Traffic</a><br><br></div><div>2/ <a href="https://github.com/Project-OSRM/osrm-backend/pull/2399">https://github.com/Project-OSRM/osrm-backend/pull/2399</a> is for decoupling weights and ETAs.<br><br></div><div>3/ Using the Raster feature you don't have to edit the OSM file, you can simply overlay your raster data and let OSRM handle the interpolation for you<br><br><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>What you could do is add your own tags to a OSM base map (e.g. pollution=low,medium,high tags on ways), then in the Lua profile's way_function parse these tags and set speeds depending on the values.<br><br></div><div>A great tool for reading, modifying and writing OSM xml/pbf files is libosmium.<br><br><a href="https://github.com/osmcode/libosmium">https://github.com/osmcode/libosmium</a><br><br></div><div>Cheers,<br></div><div>Daniel J H<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 6, 2016 at 6:13 AM, Pedro Luiz Cumino <span dir="ltr"><<a href="mailto:pedro.cumino@gmail.com" target="_blank">pedro.cumino@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div><span style="font-size:12.8px">"</span><span style="font-size:12.8px"><i>For this you need to map from your sensor's location to OSM ids in order to update edge weights.</i></span><span style="font-size:12.8px">"</span><br></div><div><span style="font-size:12.8px"><br></span></div></span><div><span style="font-size:12.8px">This is what is coming to my mind:</span></div><div><span style="font-size:12.8px">1) What's the relationship between the OSM IDs and a geolocation (latitude, longitude)? Is there any relationship? I don't think it is feasible to use the nearest street engine with the sensors location in order to get the IDs of the nearest street segment for each sensor and then edit the update-speed file to finally run the route engine. Is there any method to get the street segment ID once I have the position I want?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">2) I understand that changing the speed would be costly when choosing a way. However, I don't see it's useful for pedestrians once the foot speed is much lower than the maximum speed of every street. So, from where should I start to implement something other than the speed route? </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">After some reading:</span></div><div><span style="font-size:12.8px">3) What I understand until now is that I should edit the OSM file in order to add some reference or tag information about the segment/way condition (pollution, segment barrier, etc). Afterwards, create a </span><i>Lua</i><span style="font-size:12.8px"> profile and use those added tags in order to implement a </span><span style="font-size:12.8px">logic  to avoid some segments/ways</span><span style="font-size:12.8px">. Something like described </span><a href="https://www.mapbox.com/blog/osrm-using-external-data/" style="font-size:12.8px" target="_blank">here</a><span style="font-size:12.8px"> and already implemented.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">So the final questions are:</span></div><div><span style="font-size:12.8px">Is there any documentation about how edit an OSM data in order to add third party data?</span></div><div><span style="font-size:12.8px">Am I thinking reasonably to solve this problem?</span></div><div><span style="font-size:12.8px">Is there any documentation about how lua shall be used in this context? Should I use the built profiles as a reference instead of checking an already existent documentation about Lua for OSRM?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks!</span></div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 30, 2016 at 7:17 AM, Daniel Hofmann <span dir="ltr"><<a href="mailto:hofmann@mapbox.com" target="_blank">hofmann@mapbox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">https://github.com/Project-OSR<wbr>M/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" target="_blank">https://github.com/Project-OSR<wbr>M/osrm-backend/wiki/Integratin<wbr>g-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" target="_blank">https://github.com/Project-OSR<wbr>M/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="m_1323341185767881888m_-6829924240956356863HOEnZb"><div class="m_1323341185767881888m_-6829924240956356863h5"><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><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>
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><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-630<wbr>854-217931/route-solution.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-630<wbr>854-217935/route-solution-with<wbr>Barriers.gif</a>><span><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>
</div></div><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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_1323341185767881888m_-6829924240956356863gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="text-align:left"><span style="color:rgb(51,51,51);font-family:monospace,monospace;font-size:small">Atenciosamente,</span><br></div><div style="text-align:left"><font size="2"><span style="font-family:monospace,monospace"><font color="#333333">Kind regards,<br><br></font></span></font></div><div style="text-align:left"><font size="2"><span style="font-family:monospace,monospace"><span style="color:rgb(51,51,51)">Pedro Luiz Cumino.</span></span></font></div></div></div></div></div></div></div></div></div>
</div></div></div></div>
<br>______________________________<wbr>_________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org">OSRM-talk@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.<wbr>org/listinfo/osrm-talk</a><br>
<br></blockquote></div><br></div>