Fooling around with Google Maps

They say you shouldn’t take your work home but, if you’re lucky, sometimes your curiosity is piqued by something that you just have to investigate on your own time.  No, I’m not talking about cyber stalking the office babes on their Facebook pages, quiet down at the back.  This week, I’ve been putting the finishing touches to our new conference call scheduler application and, while implementing a Google maps tool for calculating time zone differences, I started thinking about their zoom levels.  I can’t tell you how many times I’ve tried to print off directions and found that the route was too small to be clear, then zoomed in and found the route didn’t quite fit all on one screen.  It seems like a big leap at those times, yet when you’re looking at the whole world, or zoom all the way in to one street, the contrast between stages isn’t nearly so obvious.  So what is the change in scale each time you click the plus or minus?

The application Google supply contains a suite of useful procedures, including one which tells you the longitude and latitude of the four corners of the visible area at any one time.  So I wrote a small script that would subtract the latitude difference between the top and bottom of the map view whenever I clicked a button, giving me the real distance that was represented by the height of the map area.  Then all I had to do was click, zoom in, click.. and so on.

Zoom levels in Google are represented by numbers which you can see if you use the ‘link’ button on the normal maps site.
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=TW9+1SE&sll=57.704147,0&sspn=1.655398,5.822754&ie=UTF8&t=h&z=16&iwloc=A

The most zoomed out level is 0 and the most zoomed in is 17 (it used to be 15 but as better quality aerial photography and streetview came along it was extended).  Here are the relevant distances for a few zoom levels, in degrees.

5 6.39341931
6 3.196849481
7 1.598441987
8 0.799223142
9 0.399611839

(As an aside, to convert longitude difference to miles, divide the Earth’s circumference in miles (24,901.463) by 360.  Amusingly, because I am 12 years old inside my head, this comes out at about 69)

Anyway, the numbers look pretty arbitrary, right?  I pasted the results into Excel and created a third column with a formula which divided each number in the list by the one after it.  Here’s what I got:

Zoom Distance Distance ratio
0 153.3373324 1.58142375
1 96.96157175 1.908420623
2 50.80723325 1.988817298
3 25.54645583 1.998239156
4 12.78448365 1.999631658
5 6.39341931 1.999912523
6 3.196849481 1.999978421
7 1.598441987 1.999994623
8 0.799223142 1.999998657
9 0.399611839 1.999999664
10 0.199805953 1.999999916
11 0.099902981 1.999999979
12 0.049951491 1.999999995
13 0.024975746 1.999999999
14 0.012487873 2
15 0.006243936 2
16 0.003121968 2
17 0.001560984 ERR

Ho ho! Looks like that third column is pretty much constant, except at the top end.  That’s probably down to inaccuracies in the projection.  All flat maps have errors when you try to show a spherical shape on a flat map and they’re always worse near the poles.  But otherwise, case closed!  Every click on the Google map zoom doubles or halves the size of what you can see.  Which is why it seems like such a big difference when I’m trying to print those directions.

Only one question remains: how can I use this knowledge to impress the girls in the office?

Comments

  1. #1 by Paula Williams at 22nd May 2009

    Do I count as a ‘girl in the office’? Hope so as am impressed by all these charts, they just ‘do it’ for me Carl ;-)

(will not be published)