Closed kmmramos closed 1 year ago
Currently, we have a method that gets the distance matrix from google distance api.
public async Task<DistanceMatrix?> GetDistanceMatrix(List<string> rawDestinationAddress, string rawOrigin, string travelMode = "DRIVING", string unitSystem = "imperial") { var destinationAddress = JsonSerializer.Serialize(rawDestinationAddress.Select(x => HttpUtility.UrlEncode(x))); string url = @$"api/distancematrix/json?origins={HttpUtility.UrlEncode(rawOrigin)} &destinations={destinationAddress} &travelMode={travelMode} &units={unitSystem} &key={Config.Key}"; return await HttpClient.GetFromJsonAsync<DistanceMatrix>(url); }
Even though we're sending in units=imperial, we always get km in distance.text.
Note: We have tested it just using browser and in there, it returns miles but when we use it in our project, we always get km.
May we know what's the right value for units?
Please file this as a bug in the Public Issue Tracker for the Distance Matrix API. This repo is for documentation of the API.
Currently, we have a method that gets the distance matrix from google distance api.
Even though we're sending in units=imperial, we always get km in distance.text.
Note: We have tested it just using browser and in there, it returns miles but when we use it in our project, we always get km.
May we know what's the right value for units?