In a nutshell what I want to do is to identify the center tile from the result of “map.getCenter()”.
I am building my first OpenStreetMap/OpenLayers application and am using “new OpenLayers.Layer.OSM()” for my map layer. When I request the coordinates of the center using “map.getCenter()” with a zoom level of 10, the resulting longitude/latitude are returned in the form lon=1813763,lat=6155449 (in degrees the center is roughly Lon=16.4° and Lat=48.3°). I have never seen coordinates like this before but on reading up on the “Spheroid Mercator” at http://docs.openlayers.org/library/spherical_mercator.html which states “Any time you see the string “EPSG:4326”, you can assume it describes latitude/longitude coordinates. Any time you see the string “EPSG:900913”, it will be describing coordinates in meters in x/y.”, I assumed that these coordinates are in EPSG:900913. Please correct me if I am mistaken.
After reading about tile naming in http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames it seems I can use the EPSG:900913 X/Y coordinates to ascertain the tile number. However if I use the result of “map.getCenter()” in the URL’s http://tile.openstreetmap.org/10/1813763/6155449.png or http://tah.openstreetmap.org/Tiles/tile/10/1813763/6155449.png I get a “Not Found” message.
I seem to have got myself hopelessly confused and would really appreciate an explanation of what I need to do with the result of “map.getCenter()” in order to use it to identify and download the relevant tile.