var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix({
origins: [source],
destinations: [destination],
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.IMPERIAL,
avoidHighways: false,
avoidTolls: false
})
我使用此代码将单位从公里更改为英里但不起作用。 我必须使用谷歌地图连接到区域。我必须以英里为单位显示距离。
答案 0 :(得分:0)
根据Google Docs on the Distance interface(参见下面的屏幕截图),value
属性始终以米为单位显示。只有text
属性使用请求中指定的单位系统。