0

The below doc says by default the units will show based on the origin. https://developers.google.com/maps/documentation/distance-matrix/overview#units

I am testing with two addresses both in USA. I am expecting the distance to show in miles but it shows in km. Any idea how to get the results as per the documentation. Below is my test query (removed the API Key). I am not sending the units here as per the doc it should be handled automatically by the origin?

https://maps.googleapis.com/maps/api/distancematrix/json?origins=40.56289771529413,-74.32660038907106&destinations=40.86257148047112,-74.77304115053154&key=MY_API_KEY

MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
Sowmyan Soman
  • 853
  • 1
  • 9
  • 21
  • How are you retrieving the distance from the result? Per [the documentation](https://developers.google.com/maps/documentation/distance-matrix/overview#DistanceMatrixElement), there are two values, a number in meters and a string in the units specified. – geocodezip Sep 01 '21 at 01:24
  • String, that doc says either in the unit specified or by the origin. I want to validate this behavior as per the same doc , it should show the result in metric or imperial based on the origin. Is that right ? – Sowmyan Soman Sep 01 '21 at 04:02
  • 1
    This looks like a bug. I suggest you file a new bug in the DistanceMatrix [issue tracker](https://issuetracker.google.com/issues?q=status:open%20componentid:188832). You can cross-link the created issue here / link to this question in the issue. – MrUpsidown Sep 01 '21 at 08:05
  • Thank you @MrUpsidown. I have reported just now. – Sowmyan Soman Sep 01 '21 at 19:50
  • 1
    I can't see your issue. Where is it? – MrUpsidown Sep 01 '21 at 21:51
  • https://issuetracker.google.com/issues/110856538 – Sowmyan Soman Oct 16 '21 at 18:48
  • you should add to the url &units=imperial – Dimitar Oct 24 '21 at 19:51

0 Answers0