distance-matrix-api icon indicating copy to clipboard operation
distance-matrix-api copied to clipboard

Ordering of origins is reversed

Open rvignesh89 opened this issue 8 years ago • 1 comments

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

rvignesh89 avatar Mar 10 '17 07:03 rvignesh89

Yes, also had an issue with this. I'll get it fixed on the next release. 👍

C404 avatar May 05 '17 10:05 C404