我们如何从字母数字值,变量源,目标中提取数字;距谷歌地图的距离分别带有数字Km或Miles如何删除该aplhabet。
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
google.maps.event.addDomListener(window, 'load', function () {
new google.maps.places.SearchBox(document.getElementById('txtSource'));
new google.maps.places.SearchBox(document.getElementById('txtDestination'));
directionsDisplay = new google.maps.DirectionsRenderer({ 'draggable': false });
});
function GetRoute() {
var heathrow = new google.maps.LatLng(51.4711620, -0.4523710);
var mapOptions = {
zoom: 7,
center: heathrow
};
map = new google.maps.Map(document.getElementById('dvMap'), mapOptions);
directionsDisplay.setMap(map);
var distanceMeters = response.rows [0] .elements [0] .distance.value;
您可以在此处获得以米为单位的价值,而无需走得更远和公里。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句