NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I am creating my own tile server for OSM using Windows Server 2003.
I need help on how to make tiles expire and create new tiles after updating my postgres DB with osm diffs.

Since I am using Windows 2003, I can not use mod_tile. Here is my stack so far:

  1. Data: OSM Planet dump
  2. DB: Postgres with PostGIS
  3. Web Server: Apache Tomcat
  4. OS: Windows Server 2003
  5. UI: OpenLayers
  6. DB loader: osm2pgsql
  7. Tile Maker: Mapnik

I am currently serving up tiles from a folder on my server using the OpenLayers.Layer.OSM class, i.e. I am not using TileCache or anything else. I see you can you use the --expire-tiles option within osm2pgsql to create a list of expired tiles after you append new OSM data into the DB.
How do I use this option to then create new tiles? Is this the right way to even proceed?
Any help would be greatly appreciated. Please feel free to be as detailed as you can afford ;-)

asked 21 Sep '10, 15:47

maw269's gravatar image

accept rate: 0%

edited 21 Sep '10, 16:13

Frederik%20Ramm's gravatar image

Frederik Ramm ♦


May I ask where mod_tile fails on windows? Given that it is a apache module, it should be crossplatform capable. I don't know of anyone who has tried it though, so it might well need some tweeks to get it to build.

(21 Sep '10, 20:54) apmon

First of all, you have to understand that this is not a high performance setup and that you will not be able to keep a current set of tiles for anything larger than a small country with this. With no on-demand tile rendering you will always struggle to keep every single tile current, spending lots of CPU cycles for nothing.

You are probably using from the OSM Mapnik SVN. There is a function in there that calculates a single tile. With a little bit of Python you should be able to adapt the script to actually read the file generated by osm2pgsql and call the tile compute routine for each tile in that file. I am not aware of a ready-made solution for that in a renderd setup you could use render_expired but you'll have to do it that way.

You can request osm2pgsql to output a list of modified tiles for a whole range of zoom levels. Be aware that if you include small zoom levels then the tiles on these zoom levels will be rendered very often; you might want to employ some grep/sort magic and re-render those only once every few days.

All in all, the mechanisms involved are complex and PostGIS caching performance is less if you render a flurry of new tiles across a large area compared to systematically rendering all tiles. You might find that with the rather small area you're able to cover with your setup anyway, it might be easier and not even slower to just re-render the whole lot once in a while rather than trying to process updates.

permanent link

answered 21 Sep '10, 19:31

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 21 Sep '10, 15:47

question was seen: 8,115 times

last updated: 21 Sep '10, 20:54

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum