as java developer and road bike cycle enthusiast I am very happy to be able to adjust the existing road bike vehicle profile (RacingBikeFlagEncoder) to my personal preferences.
After two hard days with the code and test data I have now a working profile that generates the routing I personally prefer - but at the core of my java-developer-heart I am struggling understanding the impact of my changes/adjustments…
In order to understand my dilemma, I want to explain briefly what are my personal/private preferences when it comes to road bike cycling.
cycle ways are fine in general - but except for ‘trunk’ or ‘primary’ highways I personally prefer to stay on the road (no matter of OSM attribution like ‘bicycle:use_sidepath’ or ‘cycleway:track’) - this becomes even more important when there are roundabouts on my way… Here are two examples:
highway=‘service’ is not a route I want to ride - again with short example: https://graphhopper.com/maps/?point=52.065413%2C8.386168&point=52.064866%2C8.38694&locale=de-de&vehicle=racingbike&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale
the current implementation tries to send me on cycle ways as often as possible - again that’s a fine behavior when it comes to a cycle tour with my kids - but for my sports activity this behavior ist not my preferred one - I tried to solve this with additional ‘via’ points - but this can’t be the correct approach - https://graphhopper.com/maps/?point=51.799831%2C8.427265&point=51.795352%2C8.428402&point=51.788975%2C8.429024&locale=de-de&vehicle=bike&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale
I personally do not care that much about possible turn restrictions at a junction - but of course I always follow the StVO!
there are probably a bit more - (like prefer tertiary (or unclassified) over secondary or primary roads) - but this is not that essential…
Again - this are all just my personal preferences and I don’t expect that the gh road bike vehicle profile will be adjusted in any kind - I have already created a custom version of the RacingBikeFlagEncoder (created my own FactoryImpl etc…) that solves these issues above (of course only tested briefly within my cycle area).
The only thing I am currently unhappy with is, that I am not able to understand why, which adjustment was/is required in order to archive that I archived (and wanted to archive)…
So in general the adjustments are straight forward:
- make sure that we try to avoid residential areas…
- make sure that ‘yes’, ‘designated’, ‘official’ or ‘permissive’ will be ignored! - this was/is required to ignore the cycleway here https://graphhopper.com/maps/?point=52.06478%2C8.385519&point=52.064582%2C8.386023&locale=de-de&vehicle=racingbike&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale
few adjustments to surface and highway speeds - but this is IMHO not critical…
Next one is required in order to stay on the road in this roundabout https://graphhopper.com/maps/?point=51.96616%2C8.243737&point=51.964901%2C8.245153&locale=de-de&vehicle=racingbike&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale - and this is the change I am worried the most about - or better I still struggling to understand why this is required - I have tried "everything i could imagine that have to do with speeds - even setting ‘tertiary’ speed to 60 and cycleway speed to 4 (and also ensured that SurfaceSpeed would also not be higher then then ‘4’) - the routing always taking the cycleway - so finally I only could solve that by setting cycleways (and service) as pushing
- additionally I made few adjustments to the ‘collect(…)’ method - or better in the collect(…) I don’t call super.collect(…) and instead I used a local copy of BikeCommonFlagEncoder.collect(…) and removed the handling of ‘bicycle:use_sidepath’ or ‘cycleway:track’ (that have caused that roads that have his additional attributes would had been tried to avoid (if possible).
So again what’s the root cause of this topic? - On the one hand side as road bike cyclist I could be happy - since I have now a private profile that actually generates the routing I am interested in - but as developer I am more or less desperate - since I am just adjusted to code by “try & error” in order to archive what I wanted to archive - and I am looking for help (where I can find additional explanations) how VehicleFlagEncoders are working in general so that my programmer heart finally understand what I actually did…
If these adjustments are totally crap - please let me know - and please be so kind and push me into a direction that is way more reasonable - tia