Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API; how to add a scale measure on a map?

Tags:

google-maps

I suspect part of my problem is that I'm having a mental freeze on what the technical name for this is: But you see on http://maps.google.co.uk/ the bottom left has a small ruler indicating how big x Miles is at the current zoom level?

If I'm using google Maps API version 2, how do I add such a wonderful do-hickery widget thing to my website maps?

Thanks, James

like image 528
James Avatar asked Jan 19 '10 15:01

James


1 Answers

Actually this is how you really get the scale to show:

var map = new google.maps.Map(document.getElementById('map'), {
  zoom: 10,
  scaleControl: true,
  center: new google.maps.LatLng(-33.92, 151.25),
  mapTypeId: google.maps.MapTypeId.ROADMAP
});
like image 100
user1895986 Avatar answered Oct 12 '22 01:10

user1895986