Skip to content

Instantly share code, notes, and snippets.

@celoyd
Last active June 2, 2016 22:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save celoyd/7851389 to your computer and use it in GitHub Desktop.
Save celoyd/7851389 to your computer and use it in GitHub Desktop.

What zoom level is equivalent to a given altitude? In other words, if I’m looking at a map at ZL n, how high off the ground would I be to make out the same features?

This is from a question from Eric Fischer; my algebra and arithmetic are extremely rusty, so please check everything! Major assumptions:

  1. We’re at the equator.

  2. We’re looking straight down (which you can’t realistically do out a plane window, for example).

  3. We have 20/20 vision (which is not as good as median corrected vision).

  4. Distinguishing two points separated by x is equivalent to seeing something x across. In other words, just barely telling that two lights 1 m apart are different is equivalent to looking at an image with a ground-sample distance (GSD, colloquially “resolution”) of 1 m. This is probably the sloppiest assumption!

So this is all just an estimate.

Altitude from GSD

20/20 vision is defined as distinguishing lines an arc minute apart. That’s about 2.9e-4 rad.

The small angle approximation says that for objects with small angular size (so, far away for their size), their angular size in radians is roughly the diameter divided by the distance. For example, a meter-wide beachball will appear about 1/1000 rad wide when it’s a kilometer away. That’s about 3.5 arc minutes, meaning it would be very small but still clearly distinguishable from one lying one diameter away, which passes the sniff test.

From an object’s diameter in meters, this gives us an altitude in meters at which it should be borderline distinguishable under our assumptions:

altitude = diameter / 2.9e-4

Flipping around:

diameter = altitude / 3448.276

10 km is a typical (or somewhat low) medium-range passenger jet cruising altitude. That yields a distinguishable diameter of 2.9 meters, or about 9.5 ft.

ZL from GSD

The zoom level to ground sample distance conversion (from OSM’s excellent page, with constants plugged in) is:

GSD = 40,075 km * cos(latitude) / 2^(zoomlevel + 8)

Let’s work this for 45° at ZL 7:

40,075 km * cos(45°) / 2^(7 + 8)

40,075 km * 0.7071 / 2^15

28,337.0325 km / 32768

0.864 km

Again, this sniff-tests.

Let’s simplify by dropping some precision, using meters, and assuming the equator:

GSDm = 4e7 / 2^(ZL + 8)

And isolate ZL on the LHS (I can’t remember math words):

ZL = ln(156250 / GSDm) / ln(2)

Checking this with the table on the OSM wiki page, which says that ZL 15 should be 4.773 m:

ln(32736.224) / 0.693

15.002

Well within the fudge factors of our assumptions.

ZL from altitude

Now we have:

altitude = diameter / 2.9e-4

And:

ZL = ln(156250 / GSDm) / ln(2)

So, with altitude in meters:

ZL = ln(156250 / (altitude / 3448.276)) / ln(2)

Or alternately (cutting some more corners on precision, etc.):

ZL = 29 - 1.4427 * ln(altitude)

This yields ZL 15.7 for cruising altitude, which roughly fits my personal anecdata. And starting from that expression, you can repair a little of the damage made by the major assumptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment