How to return distance in "Km" using Google Distance Matrix API?
<p>I am using Google's Distance matrix API for Java.
I have properly working code but I want it to return distance between two latitude-longitude points (origin, destination) in Kilometers. But there's no such method or parameter that it takes to <strong>return distance in kms</strong>. <strong><em>However if the distance value is greater than or equal to 1km, it returns distance in km</em></strong>. But i want it to return distance always in km <strong>(for eg. 0.5 km)</strong> but it always <strong>returns distance in meters when distance is less than 1 km</strong>. I tried to use <code>Unit.METRIC</code> also but its of no use as it still returns distance in meters only.</p>

<pre><code>DistanceMatrix results =  DistanceMatrixApi.getDistanceMatrix(context, 
                    new String[] {origins}, new String[] {destinations}).units(Unit.METRIC).await();

results.rows[0].elements[0].distance //returns in meters, i want it in kms.
</code></pre>