Hi there everybody.
I’m still quite new to OpenStreetMap.
I’ve got a simple src tag, allowing me to get one simple map tile, at a given zoom level.
Let’s say my test link is this :
<img src="http://tile.openstreetmap.org/16/32742/21790.png" width="256" height="256">
As I can see, zoom 16 is a folder, the X Index of the Map Tile is a folder, and the Y Index is the actual name of the png file.
Now, the question.
Knowing these parameters : Zoom=16 / X=32742 / Y=21790 / Scale=256
how could I get the coordinates of the bounding box of this particular tile ?
I mean the Min Longitude / Max Longitude and Min Latitude / Max Latitude of this tile ?
Is there some kind of furmula to calculate the coordinates from the values in the link ?
Thanks to anyone able to help.
May 2, 2014, 12:57pm
OT: It’s an “img”-tag with a “src”-attribute
That’s what I needed.
The “Tile numbers to lon./lat.” pseudo-code, given tile’s X index, Y index and Zoom, returns the coordinate of the Top-Left corner of the tile, which is maximum Lat and minimum Lon.
To get the other 3 points I did as follows :
Top-Right corner : (X+1) index, Y index, Zoom
Bottom-Right corner : (X+1) index, (Y+1) index, Zoom
Bottom-Left corner : (X) index, (Y+1) index, Zoom
If I’d like to know the Center tile’s coordinates I should do as follows, I guess :
LatCenter = LatMin + ( LatMax - LatMin ) / 2
LonCenter = LonMin + ( LonMax - LonMin ) / 2
Another little question :
If I copy image link in my browser on each OSM’s map tile, at different zoom levels, I get links as follows :
What are those “a.”, “b.”, “c.” letters ?
I see that tiles are also available without them in the link :
They are only aliases for
tile.openstreetmap.org, because most browsers restrict their connections per host.