<div dir="ltr">I understand but my question was (sorry if it was unclear), why is it different between train and bus?</div><div class="gmail_extra"><br><div class="gmail_quote">2018-05-01 10:02 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 class="">On Tue, May 01, 2018 at 09:30:36AM -0400, Patrick Agin wrote:<br>
> Thanks Michal and Daniel for your help, I defined my subway profile and it<br>
> works well.<br>
> <br>
> Michal, can I ask you why you use this kind of code for the train profile:<br>
> train = way:get_value_by_key('train');<br>
> if ( not data. train or data. train =='') then return false;<br>
<br>
</span>this checks way's tags<br>
<span class=""><br>
> <br>
> and this kind of code for the bus:<br>
> bus = get_from_rel(relations, way, "route", "bus", "route");<br>
> if ( not data.bus =='') then return false;<br>
<br>
</span>this one checks relations' tags (of relations that the way is a member<br>
of)<br>
<div class="HOEnZb"><div class="h5"><br>
> Aren't they defined the same way in osm data?<br>
> Patrick<br>
> <br>
> 2018-04-30 13:26 GMT-04:00 Patrick Agin <<a href="mailto:agin.patrick@gmail.com">agin.patrick@gmail.com</a>>:<br>
> <br>
> > Thanks again Michal I'll try it soon with subway instead of bus. Out of<br>
> > curiosity, why do you define highway in process_way function? It does not<br>
> > seem to be used elsewhere.<br>
> ><br>
> > 2018-04-30 13:03 GMT-04:00 Michal Palenik <<a href="mailto:michal.palenik@freemap.sk">michal.palenik@freemap.sk</a>>:<br>
> ><br>
> >> 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>
> >> generally to ignore trains when they do not have a common ticketing<br>
> >> scheme.<br>
> >><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>
> >> 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-<wbr>OSRM/osrm-backend/issues/5032</a><br>
> >><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">michal.palenik@freemap.sk</a>>:<br>
> >> ><br>
> >> > > hi, I have it working<br>
> >> > > <a href="https://github.com/FreemapSlovakia/freemap-routing/blob/" rel="noreferrer" target="_blank">https://github.com/<wbr>FreemapSlovakia/freemap-<wbr>routing/blob/</a><br>
> >> master/oma-bus.lua<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"<br>
> >> 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-<wbr>OSRM/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<br>
> >> way in<br>
> >> > > the<br>
> >> > > > OSM file you input, and it decides whether to include it in the<br>
> >> routing<br>
> >> > > > graph (by setting properties on the `result` object), or to exclude<br>
> >> it<br>
> >> > > (by<br>
> >> > > > simply returning without doing any work).<br>
> >> > > ><br>
> >> > > > As someone else pointed out in another thread, the `car.lua`<br>
> >> profile is<br>
> >> > > > pretty complex - it's developed over time, and has a lot of logic<br>
> >> in it<br>
> >> > > > that makes it hard to understand. I'd start with the testbot<br>
> >> 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-<wbr>OSRM/osrm-frontend/tree/gh-<wbr>pages/debug</a><br>
> >> 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 <<br>
> >> <a href="mailto:agin.patrick@gmail.com">agin.patrick@gmail.com</a>><br>
> >> > > > wrote:<br>
> >> > > ><br>
> >> > > > > Thanks again Daniel. Could you just give me an example (with a<br>
> >> snippet<br>
> >> > > of<br>
> >> > > > > code maybe) of a good implementation of point 1 (Lua profile that<br>
> >> only<br>
> >> > > > > includes public transport ways in the graph). I just don't have<br>
> >> any<br>
> >> > > clue<br>
> >> > > > > about implementing this and I'm not aware of any docs that could<br>
> >> 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">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<br>
> >> 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<br>
> >> 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<br>
> >> 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<br>
> >> transport<br>
> >> > > paths<br>
> >> > > > >> are not connected, then any GPS trace you have that spans two<br>
> >> 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<br>
> >> the<br>
> >> > > > >> map-matching algorithm.<br>
> >> > > > >><br>
> >> > > > >> daniel<br>
> >> > > > >><br>
> >> > > > >> On Mon, Apr 30, 2018 at 7:23 AM, Patrick Agin <<br>
> >> <a href="mailto:agin.patrick@gmail.com">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<br>
> >> public<br>
> >> > > > >>> transport routes only. I tried to add residential in excludable<br>
> >> 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<br>
> >> 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">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>
> >> > > > >>><br>
> >> > > > >><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>
> >> > > > >><br>
> >> > > > ><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>
> >> > > > ><br>
> >> > ><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>
> >> > ><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">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>
> >><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>
> >><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">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>
> ><br>
> ><br>
<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>
<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">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>
</div></div></blockquote></div><br></div>