I'm simply displaying a map, with no routing or directions. I can add the control with mapOptions = {...scaleControl: true,...} but I could find no documentation about changing the units of the scale to imperial.
Here's my code:
var mapOptions = {
zoom: 4,
mapTypeControl: false,
center: new google.maps.LatLng(38.8282, -98.5795),
mapTypeId: google.maps.MapTypeId.ROADMAP,
scaleControl: true,
scaleControlOptions: {position: google.maps.ControlPosition.BOTTOM_LEFT}
};
google.maps.visualRefresh = true;
map = new google.maps.Map(document.getElementById('map'),mapOptions);
Note: The ControlPosition appears not to work, always goes to bottom right.
Simply go to the View menu and click Scale Legend> The scale will change constantly as you zoom in and out.
Try this temp solution (here it is in a ready function):
var scaleInterval = setInterval(function() {
var scale = $(".gm-style-cc:not(.gmnoprint):contains(' km')");
if (scale.length) {
scale.click();
clearInterval(scaleInterval);
}
}, 100);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With