distance-matrix-api
distance-matrix-api copied to clipboard
Ordering of origins is reversed
For my use case I need to create Map based on the response from Google Distance Matrix like below,
%{%{origin=>{lat,long},dest=>{lat,long}}=> {duration,distance}}
Since the response from the API converts coordinates into location I can't use the array returned by them to know which element corresponds to which source and destination. So I'm using the order in which I send the information to determine mapping of the results.
However because of how TravelList is constructed this list gets reversed. I feel this is a subtle but important change.
def add_entry(travel_list, travel = %{origin: origin, destination: destination}) do
List.insert_at(travel_list, -1, travel)
end
Yes, also had an issue with this. I'll get it fixed on the next release. 👍