<div dir="ltr">Thanks Michal and Daniel for your help, I defined my subway profile and it works well.<div><br><div>Michal, can I ask you why you use this kind of code for the train profile:</div><div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><span class="gmail-author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8z85zz77zz122zaz73z3z77z4z85zz72zz78zvxdz71zaz81z9z77zhr6xnz90zuz88zz67zat">train = way:get_value_by_key('train');</span></code></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><span class="gmail-author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8z85zz77zz122zaz73z3z77z4z85zz72zz78zvxdz71zaz81z9z77zhr6xnz90zuz88zz67zat">if ( not data. train or data. train =='') then return false;</span></code></div></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><span class="gmail-author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8z85zz77zz122zaz73z3z77z4z85zz72zz78zvxdz71zaz81z9z77zhr6xnz90zuz88zz67zat"><span style="font-family:arial,sans-serif"> </span></span></code></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><span class="gmail-author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8z85zz77zz122zaz73z3z77z4z85zz72zz78zvxdz71zaz81z9z77zhr6xnz90zuz88zz67zat"><span style="font-family:arial,sans-serif">and this kind of code for the bus:</span><br></span></code></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><span class="gmail-author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8z85zz77zz122zaz73z3z77z4z85zz72zz78zvxdz71zaz81z9z77zhr6xnz90zuz88zz67zat"><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript">bus = get_from_rel(relations, way, "route", "bus", "route");</code></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript">if ( not data.bus =='') then return false;</code></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><br></code></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><font face="arial, sans-serif">Aren't they defined the same way in osm data?</font></code></div><div><code class="gmail-listtype-code gmail-listindent1 gmail-list-code1 gmail-lang-coffeescript"><font face="arial, sans-serif">Patrick</font></code></div></span></code></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-04-30 13:26 GMT-04:00 Patrick Agin <span dir="ltr"><<a href="mailto:agin.patrick@gmail.com" target="_blank">agin.patrick@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks again Michal I'll try it soon with subway instead of bus. Out of curiosity, why do you define highway in process_way function? It does not seem to be used elsewhere.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2018-04-30 13:03 GMT-04:00 Michal Palenik <span dir="ltr"><<a href="mailto:michal.palenik@freemap.sk" target="_blank">michal.palenik@freemap.sk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Mon, Apr 30, 2018 at 12:57:42PM -0400, Patrick Agin wrote:<br>
> Thanks a lot to both of you. Michal, can I ask you two things:<br>
> what's the purpose of adding tram and train to excludable?<br>
<br>
</span>generally to ignore trains when they do not have a common ticketing<br>
scheme. <br>
<span><br>
> and about get_from_rel(relations, way, "route", 'bus', "route") line, is<br>
> 'bus' a reserved OSM word or is it defined by you? <br>
<br>
</span>function get_from_rel(relations, way, "route", 'bus', "network")<br>
will find first/random relation of route=bus which the way is a member<br>
of, and then returns tag "network".<br>
<br>
see also<br>
<a href="https://github.com/Project-OSRM/osrm-backend/issues/5032" rel="noreferrer" target="_blank">https://github.com/Project-OSR<wbr>M/osrm-backend/issues/5032</a><br>
<div class="m_-2319843987218164038HOEnZb"><div class="m_-2319843987218164038h5"><br>
> I ask the question<br>
> because I would like to manage subway routes.<br>
> Patrick<br>
> <br>
> 2018-04-30 12:48 GMT-04:00 Michal Palenik <<a href="mailto:michal.palenik@freemap.sk" target="_blank">michal.palenik@freemap.sk</a>>:<br>
> <br>
> > hi, I have it working<br>
> > <a href="https://github.com/FreemapSlovakia/freemap-routing/blob/master/oma-bus.lua" rel="noreferrer" target="_blank">https://github.com/FreemapSlov<wbr>akia/freemap-routing/blob/<wbr>master/oma-bus.lua</a><br>
> > (and train profile below)<br>
> ><br>
> > michal<br>
> ><br>
> > On Mon, Apr 30, 2018 at 09:26:22AM -0700, Daniel Patterson wrote:<br>
> > > Hi Patrick,<br>
> > ><br>
> > >   Nobody has written a "How to make a public transport profile" document<br>
> > > for OSRM, you'll have to piece it together from examples and reading<br>
> > code.<br>
> > ><br>
> > >   That said, the "testbot" profile here:<br>
> > > <a href="https://github.com/Project-OSRM/osrm-backend/blob/master/" rel="noreferrer" target="_blank">https://github.com/Project-OSR<wbr>M/osrm-backend/blob/master/</a><br>
> > profiles/testbot.lua<br>
> > ><br>
> > >   is fairly simple.  There are 3 functions: `process_node`,<br>
> > `process_way`,<br>
> > > and `process_turn`.  The `process_way` function is run for every way in<br>
> > the<br>
> > > OSM file you input, and it decides whether to include it in the routing<br>
> > > graph (by setting properties on the `result` object), or to exclude it<br>
> > (by<br>
> > > simply returning without doing any work).<br>
> > ><br>
> > >   As someone else pointed out in another thread, the `car.lua` profile is<br>
> > > pretty complex - it's developed over time, and has a lot of logic in it<br>
> > > that makes it hard to understand.  I'd start with the testbot profile<br>
> > > above, and add the stuff you think you need.<br>
> > ><br>
> > >   You might also want to take a look at<br>
> > > <a href="https://github.com/Project-OSRM/osrm-frontend/tree/gh-pages/debug" rel="noreferrer" target="_blank">https://github.com/Project-OSR<wbr>M/osrm-frontend/tree/gh-pages/<wbr>debug</a> which<br>
> > is<br>
> > > a web viewer that can show you what the routing graph looks like.<br>
> > ><br>
> > > daniel<br>
> > ><br>
> > > On Mon, Apr 30, 2018 at 8:39 AM, Patrick Agin <<a href="mailto:agin.patrick@gmail.com" target="_blank">agin.patrick@gmail.com</a>><br>
> > > wrote:<br>
> > ><br>
> > > > Thanks again Daniel. Could you just give me an example (with a snippet<br>
> > of<br>
> > > > code maybe) of a good implementation of point 1 (Lua profile that only<br>
> > > > includes public transport ways in the graph). I just don't have any<br>
> > clue<br>
> > > > about implementing this and I'm not aware of any docs that could help<br>
> > me<br>
> > > > with that.<br>
> > > > Patrick<br>
> > > ><br>
> > > > 2018-04-30 11:30 GMT-04:00 Daniel Patterson <<a href="mailto:daniel@mapbox.com" target="_blank">daniel@mapbox.com</a>>:<br>
> > > ><br>
> > > >> Hi Patrick,<br>
> > > >><br>
> > > >>   This could be tricky, depending on how long the traces you're<br>
> > trying to<br>
> > > >> match are.<br>
> > > >><br>
> > > >>   The OSRM Lua profiles basically act as a filter - they decide which<br>
> > > >> ways from OSM are included in the routing graph, and assign<br>
> > properties to<br>
> > > >> edges in the graph.<br>
> > > >><br>
> > > >>   The map-matching algorithm will try to snap your coordinate list to<br>
> > the<br>
> > > >> most likely path across the routing graph.<br>
> > > >><br>
> > > >>   In order to only snap to public transport paths, you'll need:<br>
> > > >><br>
> > > >>     1) A Lua profile that only includes public transport ways in the<br>
> > > >> graph.<br>
> > > >>     2) A way to ensure that all the public transport paths are<br>
> > connected<br>
> > > >> together (this could be difficult without including lots of extra<br>
> > stuff you<br>
> > > >> don't want in the graph)<br>
> > > >>     3) GPS traces that are somewhat close to the actual paths<br>
> > themselves,<br>
> > > >> as mapped in OSM<br>
> > > >><br>
> > > >>   (2) could be the really tricky bit here.  If the public transport<br>
> > paths<br>
> > > >> are not connected, then any GPS trace you have that spans two public<br>
> > > >> transport routes (say, a bus change, or a train change) but those<br>
> > routes<br>
> > > >> aren't actually connected by the graph, will cause problems with the<br>
> > > >> map-matching algorithm.<br>
> > > >><br>
> > > >> daniel<br>
> > > >><br>
> > > >> On Mon, Apr 30, 2018 at 7:23 AM, Patrick Agin <<a href="mailto:agin.patrick@gmail.com" target="_blank">agin.patrick@gmail.com</a><br>
> > ><br>
> > > >> wrote:<br>
> > > >><br>
> > > >>> Hi everyone,<br>
> > > >>> I'm trying to define a profile to force match service to take public<br>
> > > >>> transport routes only. I tried to add residential in excludable so I<br>
> > can<br>
> > > >>> add exclude=residential at query time but it does not change<br>
> > anything to<br>
> > > >>> the returned answer. Can someone help or point me towards<br>
> > documentation<br>
> > > >>> that could help (I've read profile.md but it does not help me much).<br>
> > > >>> Thanks a lot,<br>
> > > >>> Patrick (newbie with osrm)<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>
> > > >>><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>
> > > >><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>
> > > ><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>
> ><br>
> ><br>
> > --<br>
> > michal palenik<br>
> > <a href="http://www.freemap.sk" rel="noreferrer" target="_blank">www.freemap.sk</a><br>
> > <a href="http://www.oma.sk" rel="noreferrer" target="_blank">www.oma.sk</a><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>
> ><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>
<br>
<br>
-- <br>
michal palenik<br>
<a href="http://www.freemap.sk" rel="noreferrer" target="_blank">www.freemap.sk</a><br>
<a href="http://www.oma.sk" rel="noreferrer" target="_blank">www.oma.sk</a><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>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>