I'm creating a web interface where users click on a map to denote a point of interest. My application then returns all items in a database that lie within a specified distance of that point. I'm only concerned with UK (I mention this in case there's a good approximation available) and primarily working with zoom=9. AIUI, each tile covers a certain angle of latitude and longitude rather than distances over the ground. Thanks to the information in this wiki article, I can calculate the distance between the top-left corners of adjacent tiles (and hence derive the distance over the ground for any tile), but that seems rather messy.
asked
Pajaholic |

You can calculate it yourself, based on this wiki page:
The resolution means how many meters per pixel you get. If you want to know how many pixels per meter, just use the inverse. That is:
And if you want to calculate the scale (to write it on the map for printing it):
The scale means, how many cm in reality is 1 cm on the paper (or on the screen). So if you have a screen with 96 dpi, you get that one pixel is 1.1943 meters. And you get a scale of 1 : 4 231 which means that 1 cm on your screen is 42.3 m in reality. If you have a printer which prints 300 dpi … (now do the calculations yourself).
answered
erik |

If you are happy with an approximation then think about this: - At zoom level 9, your world has 2^9 by 2^9 tiles (that's 512x512 tiles).
- The Earth's circumference is roughly 40,000 kilometres.
Thus: - For the y axis, you have 20,000 km from North Pole to South Pole, divided by 512, that's roughly 39 km for the height per tile. (The 512x512 tiles don't exactly stretch all the way to the poles, only to the 85° line, but we can ignore that for this approximation.) This tile height is the same everywhere.
- For the x axis it is not quite so easy because the number of kilometres used by the 512 tiles is different depending on where you are - 40,000 km at the Equator, 25,000 at the latitude of the Scilly Isles, and 20,000 at the latitude of Unst. So it's fair to use 22,500 as an approximation for the UK; divide that by 512 and you end up at a tile width of roughly 44km.
Or very roughly: A zoom level 9 tile in the UK has 40x40km. (Double the width/height when you decrement the zoom level, halve the width/height when you increment.)
answered
Frederik Ramm ♦ |