Complex mathematical question... Help!

Okay… :stuck_out_tongue:

If I have a viewport of the Slippy map (Mercator projection) which is ‘w’ pixels wide, and ‘h’ pixels high, and we’re at zoom-level ‘Z’, what is the range of x and y Mercator coordinates?

For example, if the viewport is 256 x 256 and we’re at zoom level 0, then there should be a range of 360 x-coordinates (-180 to 180 degrees), and 360 y-coordinates (also -180 degrees).

I know, a bit of a strange question. Please reply if you have any questions (or answers for that matter!)

Nevermind, I figured it out;

x-span = 360 * (width / (256 * (2 ^ zoom)))
y-span = 360 * (height / (256 * (2 ^ zoom)))

:smiley: