6095 route calculate distance and time cost between stops
Created by: teddywing
Calculate distance and time costs between each stop in a Chouette::Route.
When a Chouette::Route is saved, its "way costs" will be calculated and saved into a new JSON field in the routes table called costs. The costs field is supposed to model the structure of journey_patterns.costs. In order to calculate costs, we make a request to the TomTom API (https://developer.tomtom.com/online-routing/online-routing-documentation/batch-routing) and save the distances and times it gives us. In order to be able to calculate costs, the route's StopAreas must have latitude and longitude values.
The cost data will be used to pre-fill the fields in the edit view of http://stif-boiv.dev:3000/referentials/4/lines/1857/routes/1/journey_patterns_collection
Refer to this doc to configure the TomTom API key: https://github.com/af83/chouette-its-doc/blob/5c97a55546a6bb21c32b271abb6c706bdadd0930/tomtom.md
I recommend reviewing this with https://github.com/af83/stif-boiv/pull/379/files?w=1