Updating SMART-GH to use the newest version of GraphHopper

I’m using SMART-GH for a project (routes based on air quality), but thinking of upgrading the project to GraphHopper 2.0 in order to use newest features (Android app, etc.)
What would be the easiest way to do it? Any tips are welcome :slight_smile:

Link to SMART-GH repository:

Hard to say without knowing your project, but generally I recommend Option 2 here: https://github.com/graphhopper/graphhopper/pull/2106#issuecomment-688914649

So your routes prefer regions with low air pollution (avoid cities etc.) or what is this about?

Thanks for your reply.

I am trying to achieve city navigation to avoid more polluted streets (primarily for pedestrians and cyclers).
There is a data set of air pollution data with about 20 metres accuracy (20 metres between two points). It contains a value of pollution for each pair of coordinates. For now I only have data for London but will be looking into other cities if it works well enough for London. As far as I understand, SMART-GH uses Python scripts to pre-process the data and assign a ‘rating’ to each street and stores it in a redis database.
When creating a route, Graphhopper fetched data from redis and chooses less polluted streets using a class LeastSmokeyWeighting.
(https://github.com/DIVERSIFY-project/SMART-GH/blob/master/core/src/main/java/com/graphhopper/routing/util/LeastSmokeyWeighting.java)

How could I modify the newest version of Graphhopper to work in a similar fashion? (i.e. fetch rating of each street when creating a route).
If you know of any other way to utilise the dataset without using redis and ‘street rating’ please let me know.

Thank you for your time, I really appreciate any help!

No I think writing your own weighting that uses the data from redis to calculate the weight is still possible and probably a good solution for your problem.

If you are using CH then this should be fine also regarding query speed (for latest GH).

If you are using non-CH then I would recommend feeding the data (from redis) into GraphHopper before to avoid going to redis for every edge. The simplest way is to add a new EncodedValue and use that in a CustomWeighting to dynamically evaluate it and even change the influence of it depending on some per-request parameters. See my comment here: Change speed for certain vehicle profile

1 Like

Note that even for CH it might be better to use the EncodedValue, because even with CH the weighting is evaluated (redis would be queried) while routing. And like karussell said this way you can use it with CustomWeighting (since GH 1.0).

1 Like