[OSM-dev] How is the tile-index implemented/used?
tom at compton.nu
Thu May 14 12:11:50 BST 2009
Daniel Gilbert wrote:
> My name is Daniel Gilbert, I am 22 years old and I am currently working
> on an offline routing tool for windows. Well, to be honest, I am still
> at the beginning. The idea has grown over weeks and months, and now I am
> somehow stuck. I'm wondering how I can create a tile from the raw data.
> I plan to use the same scheme like Osmrender or Mapnik do (this
> "z/x/y.png" thingy...).
> But how do I know which ways or nodes are in the tile
> "15/17192/10659.png"? Well, I took a closer look at the database scheme
> and noticed the "tile" column in the "ways" table. After reading a (er,
> no, THE) German OpenStreetMap - book, I came across this little article
> on the wiki:
> As one might see, there are lots of "FIXME"'s and unfortunately no
> information about how the conversion is done at the moment.
The tile numbers in the API database are *not* the same as the tiles
displayed on the slippy map.
The reason is that API tiles are based on equal angular division along
lines of longitude and latitude, while slippy map tiles are based on
equal divisions of the mercator projected map.
Basically you can ignore the complicated stuff on that wiki page - the
only part we did is the first bit of dividing each line of lat/lon into
65536 equal parts to get to 16 bit numbers which are then interleaved to
get a single 32 bit tile ID value.
Tom Hughes (tom at compton.nu)
More information about the dev