Repository navigation
mapbox profile specific voice instructions - #3165
Conversation
e2c4bdb to
13a1145
Compare
boldtrn
left a comment
There was a problem hiding this comment.
Having different distance configs depending on the profile makes a lot of sense 👍
karussell
left a comment
There was a problem hiding this comment.
Thanks a lot!
Instead of using the mapboxProfile (and defaulting to "driving" for POST) could you use the resolverMap and use graphhopper names? Then we could use the profile parameter directly also for POST.
|
I discovered I was mixing "hiking" and "walking" (correct one is "walking", so I need to update the PR anyway. |
|
@karussell ping ? |
But how is this case supported at the moment? Let's say the name is "super_duper_mtb" for the mapboxProfile then currently it would end up in the wrong To fix this we could try to make the mapping to mapbox profiles configurable and maybe specify an instruction type like bike, car and foot.
Why would this be necessary? |
f991811 to
3d83be0
Compare
|
Ok, I implemented what I didn't wanted to do. Assume we have "racingbike", "mtb", "bike" GH profiles : There is no way to specify that they should use the mapboxProfile "biking" for all of them since there is no way to add the key/value pairs IMO we need a map of ghProfile -> mapbox on top or an additional attribute / property on the ghProfile . But how do you want to have it? |
|
I think we should use the ghProfile for the DistanceConfig class: Then the translation
Yes, inside DistanceConfig we need to detect if a profile is foot-alike, bike-alike or car-alike (and later maybe truck-alike). But this is independent of the For now we can make it really simple like we have in GraphHopper Maps (basically checks if it contains a certain string): public static isFootLike(profile: string) {
return profile.includes('hike') || profile.includes('foot')
}
public static isBikeLike(profile: string) {
return profile.includes('mtb') || profile.includes('bike')
}
public static isMotorVehicle(profile: string) {
return (
(profile.includes('car') && !profile.includes('cargobike')) ||
profile.includes('truck') ||
profile.includes('scooter') ||
profile.includes('bus') ||
profile.includes('motorcycle')
)
}
public static isTruck(profile: string) {
return profile.includes('truck')
}
Probably this is the part I still do not understand. How are you using homegrown profiles with the current approach? Do you have them named like mapbox? (BTW: I would have no problem if we include Another possibility could be to use a new |
|
First: It works for us, because we introduced a new endpoint for us since we needed more information than what mapbox provides in the directions response. Than we can use the Response Converter with the Bike DistanceConfig easily. Overall consensus internally is that we do not like to rely on profile names. We would like to explore navigation-transport-mode suggestion option, however this is a bit out of scope for this PR and a collegue wants to work on it since he is more experienced in this area. Will the work for you, if I revert back to the second commit and we submit a seperate one for extending profiles ? |
|
Ok |
This reverts commit 3db1c5b.
|
Reverted |
Could you already submit this (based on this PR)? |
feat: configure DistanceConfig from Profile hints
|
Thanks @karololszacki for providing the missing functionality. Since it was easier to handle it as a single PR because of the interdependencies, I merged his contribution in this branch. |
|
Thanks a lot @OlafFlebbeBosch @karololszacki ! Now the only thing is the naming. Could you change the "mapbox"-alike names like walking, cycling and driving into "GraphHopper TransportationMode"-alike names: foot, bike and car for a more consistent solution? And also the mapboxProfile parameter should be the graphHopperProfile (in the DistanceConfig constructor) as I suggested earlier. |
|
But how would that work in the Applying your suggestion @karussell I guess it would need to resolve somewhat like: Seems more convoluted, but should still work for both endpoints (GET and POST) - I'll try to do it today. |
…with OSRM/Mapbox/etc
fix: create NavigationTransportMode enum and use that
|
Merged propsal from @karololszacki for a fix |
|
Thanks a lot for the change @OlafFlebbeBosch @karololszacki !
I prefer to have the naming per default everywhere "GraphHopper"-alike and only where really necessary follow the mapbox naming. And e.g. for the POST request it should use "GraphHopper"-names and therefor utility classes like DistanceConfig should use GraphHopper names. Following this reasoning the names in the config-example.yml should use GraphHopper names too. I'm not sure the separate NavigationTransportationMode enum is necessary (maybe you mean this with "more convoluted"?). Why can't we use the TransportationMode and do the case-switch statement in the DistanceConfig? I think even your own custom profile names should be possible with this approach as you could either use the GraphHopper names in the config.yml or use a different mapbox->graphhopper mapping ( |
|
OK I think this should do it :) |
* fix: fold more cases into DistanceConfig, remove the new enum and allow usage of existing one * chore: update the example with gh-centric terms
|
Seem's like @karololszacki understood the request of @karussell way better than me :) Added his new proposal to this PR . I guess we should do a squash merge into graphhopper , in order not to show all of our tries to get everything right. |
|
@karololszacki nice, thanks a lot!
As we squash merge pull requests into master anyway we prefer to keep the pull request commits even if there are many :) (but you can squash it here too, however you prefer) |
|
Wasn't aware graphhopper project always squashes in master merge. Will not do any changes any more :) |
|
Oh wait. We found out that we have to fix the email adress in Karols contribution. |
|
I was able to rewrite the history of this patch only. Force uploading it with correct email adresses |
21a61af to
7352bb3
Compare
For cycling and hiking use different distances for announcing turn instructions:
For Biking at 150 m (i.e. roughly 500ft) and for hiking at 50m (roughly 150ft) .