| Forum | GitHub | Maps | Blog

Using custom speed limits for OSM ways


I would like to be able to use average speed data that I have gathered which assigns a speed for each OSM way. We are part of the way there in that we read the speeds in put them in a speedsMap (see e.g. changes here made by my colleague: However the speeds aren’t being used for the routing.

My question sounds a bit similar to this one Custom OSM data speed limits but not quite. It looks like I would need to write a new Encoder class that maps from osm_id to int/double but I am not sure how to do this. Is there an example I can work from, and is this the missing piece?

Thank you for your help!


If you set the speeds early in OSMReader, make sure you do this either with disabled setSpeed method in all encoders or after setSpeed is called there. Otherwise this method will overwrite it. Another possibility is to store this in a separate storage and use a Weighting that uses this separate storage.