Update valhalla.js Graphhopper to V7#948
Conversation
In API version 7 of graphhopper the support for vehicle parameter has been dropped. You have to use the profile parameter. see: https://github.com/graphhopper/graphhopper/blob/master/CHAN GELOG.md
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
For users who are still using earlier versions of Graphhopper, should we support both parameters simultaneously?
|
Thanks for your work on this! Please let me know when you're ready for this to be reviewed. Don't worry about the e2e tests failing, it's because the PR originates from your repo |
|
You can review it now with the latest code. I change te code in the github online editor. |
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
I'll need to do some testing on this. For now, please see cleanup comments
| let profilecar = false | ||
| let profileveh = true | ||
| // Only check for definition not the value. | ||
| if (process.env.GRAPH_HOPPER_V7) { | ||
| profilecar = true | ||
| profileveh = false | ||
| } |
There was a problem hiding this comment.
Since the value is always car can we instead adjust params after it is set to either add a profile: car or a vehicle: car depending on the config?
| } | ||
| const locations = points.map(p => (`point=${p.lat},${p.lng}`)).join('&') | ||
| // Avoiding motorways requires a POST request with a formatted body | ||
| const avoidmotorwaysbody = { |
There was a problem hiding this comment.
Can we make this configurable? Also please camel case
| ...(profilecar && { profile: 'car' }), | ||
| ...(profileveh && { vehicle: 'car' }) |
There was a problem hiding this comment.
re-use the dynamic object key from earlier
Checklist
devbefore they can be merged tomaster)Description
Version 7 of graphhopper api no longer supported vehicle, you have to use profile paramter instead.
See: https://github.com/graphhopper/graphhopper/blob/master/CHANGELOG.md