[GIS] How is a minimal tile server implemented

openstreetmaptile-map-service

I am trying to understand how a typical tile server is implemented in practice. I am not considering setting up a tile server but rather trying to understand from a conceptual point of view the algorithms behind a typical tile server.

So for example, as a starting point, a tile server receives a request similar to the following URL template http://[abc].tile.openstreetmap.org/zoom/x/y.png.

What are exactly the next chain of events in the processing of such a request? In the typical case of OpenStreetMap, I know that the actual data is stored in PostGis and that mapnick is used for rendering the tile.

However I have a hard time understanding how the tile is actually rendered given the zoom, x, and y inputs.

Edit: I found the following diagram, which gives you a high-level architecture of the OpenStreetMaps tile server. http://wiki.openstreetmap.org/wiki/Component_overview

Best Answer

The client is responsible for taking the template and filling in the zoom, x & y values before calling the server. So all the server sees is a URL that looks like:

http://a.tile.openstreetmap.org/0/0/0.png

which is a simple request for an image. So the simplest possible tile server is just an ordinary Apache (or Nginx) server with a series of folders for each zoom level with sub folders for each row (x) inside them containing all the tile images for that row (y.png).

More complex tile servers generate the tiles as they are requested by rendering some data and save the tile to the disk to save time later if the tile is requested again.

Related Question