I am not sure what this question points to. As far as I understand, the user selects an area that is expressed in geographical coordinates, and then uses these coordinates to calculate the fragments found.
The Slippy map tilenames in the OSM quiz has a very good explanation on how to do this:
Redesign the coordinates of the Mercator projection (from EPSG: 4326 to EPSG: 3857):
x = lon
y = arsinh(tan(lat)) = log[tan(lat) + sec(lat)]
(lat and lon are in radians)
Conversion range xand yto 0- 1and slide beginning in the upper left corner:
x = [1 + (x / π)] / 2
y = [1 − (y / π)] / 2
- Calculate the number of fragments on the map
n, using2^zoom - Multiply
xand yon n. A round of results down to give tilexand tiley.
source
share