Hi there I am currently working on geographical-based program and wondering how to get size of a tile.
Let's say that I have Googleplex's coordinate that located in latitude 37.4219999 and longitude -122.0862462. With 15 zoom level, I can get the x is 5271 and y 12706. Here's the picture
So my question is, how to get the size of tile from left to right in meters? And how do I get the specific coordinate bounds of the tile (left-top, right-top, left-bottom, right-bottom)?
Thank you.
The OpenStreetMap wiki page on "Slippy map tilenames" shows the relevant formulas as pseudocode and in various programming languages. For calculating a tile's coordinate bounds, you want "Tile numbers to lon./lat.". To get the bottom and right borders, just add 1 to your tile coordinate in that dimension.
That page also has a table with the m/px, i.e. meters per pixel values for each of the common zoom levels. Pay attention to the hint about multiplying these values by cos(latitude)
, as they depend on how far you are from the equator.