View Single Post
gnuite's Avatar
Posts: 1,245 | Thanked: 421 times | Joined on Dec 2005
#88
Originally Posted by kempja View Post
$HOME/apps/maemo-mapper/[ZOOM]/[LATITUDE]/[LONGITUDE].jpg, but that bears no relation to where I live 51.433623, -1.276541 and the tiling for level 0 starts at 65055 file with tiles named 43656, 43657.....
The "latitude" and "longitude" that are used in the directory hierarchy are not measured in degrees - it is measured in tile numbers, where 0, 0 represents the "upper-left corner" of the world.

In the mercator projection, the world is a square. Maemo Mapper divides the world into pixels, each pixel of which represents a pixel at zoom level 0. The world is 2^25 (33554432) pixels wide and high.

"Tiles" are 256x256 wide, so at zoom level 0, the world is 2^17 (131072) tiles wide and high. You're near the prime meridian, so your tile number (at zoom level 0) is near (131072 / 2).

At each zoom level above 0, the width of the world (in # of tiles) is decreased by half. So, at zoom level 5, the world is 2^12 (4096) tiles wide.

Now, you have to be careful about what lat/lon you assign to each tiles, because at high zoom levels, the lat/lon of the center of the tile and that of its upper-left corner are very different. And, due to the projection, the longitudes are easy to calculate (-180 + (tile-number / total-number-of-tiles), but the latitudes depend on the tile's distance from the equator.