[OSM-dev] Availability of slippy map during LinuxTag 2007

Jon Burgess jburgess777 at googlemail.com
Mon May 28 18:29:09 BST 2007

On Mon, 2007-05-28 at 18:37 +0200, Joerg Ostertag (OSM Munich/Germany)

> > Alternatively you could setup your own local tile server. It isn't too
> > hard to setup osm2pgsql/mapnik with either a rails server or tilecache.
> > I have these setup on my home PC and can give some hints if you get
> > stuck.
> Sounds good. can you send me the hints on how to do it. Then I would try to 
> install it on the Notebook which we take to the Linux Tag tomorrow morning.
> -

I think that using tilecache is the easiest and fastest way to render an
OSM based map on your machine. Below are the steps I used on my Fedora
machine, the file paths etc may be different in your setup.

There are dozens of steps where things can fall down. I can not give
complete details to cover every possible problem. The best thing is to
have a go and let me know if you get stuck.

You might want to start the 2 big downloads steps 13/14 first.

1) Download latest planet.bz2 file from http://planet.openstreetmap.org
(the .7z can also be used if you have 7za installed).

2) Download the 600MB shapefiles from
- you might already have a copy of these look for world_boundaries_m.shp
on your machine, there should be 26 files in total.

3) Install and run a web server on localhost

4) Place the attached tilecache.html file in your web root.

5) Make a /javascript directory in the web root and download the
OpenLayers.js into it:
$ wget -O OpenLayers23.js http://openlayers.org/api/2.3/OpenLayers.js

6) Download http://www.tilecache.org/tilecache-1.8.1.tar.gz 

7) mkdir  /var/www/wms-c and unpack the tilecache files into it

8) Place tilecache.conf in /etc/httpd/conf.d

9) Make sure you have mod_python installed (tilecache can run via CGI
but this is quite a bit slower).

10) Place the attached tilecache.cfg in /var/www/wms-c/tilecache.cfg

11) Check out the OSM svn tree (I use ~/osm/svn.openstreetmap.org)

Next we need mapnik, osm2pgsql, postgres & postgis setup. Details are at
http://wiki.openstreetmap.org/index.php/Mapnik . I've also listed them
separately below:

12) Compile mapnik (it should be part of the svn tree at

13) Compile osm2pgsql from
See the readme.txt for further help

14) copy osm2pgsql to ~/bin

15) Make sure you have postgres installed with a database called 'gis'
which has had the postgis extensions added (see the wiki page).

16) run osm2pgsql to import the planet file:
$ osm2pgsql ~/osm/planet/planet-070516.osm.bz2
$ 7za x -so ~/osm/planet/planet-070516.osm.7z | osm2pgsql

This should take around 10 - 30 minutes to import the planet file
depending on your hardware.

17) Update
~/osm/svn.openstreetmap.org/applications/rendering/mapnik/osm.xml with
your local file paths and Postgres connection parameters. I use the
convert script in that directory to make the changes:
$ ./convert osm.xml > osm-jb-merc.xml

18) Update the mapfile= line in /var/www/wms-c/tilecache.cfg to point to
your modified osm.xml file.

Restart web server. Cross fingers. Point web browser at

If it fails, first check the apache error log. On Fedora I needed to
turn off the selinux protection to allow a the tilecache script to open
a socket to connect to the DB (setenforce 0).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20070528/50a0a30b/attachment.html>
-------------- next part --------------
ScriptAlias /wms-c/ "/var/www/wms-c/"

<Directory /var/www/wms-c/>
     AddHandler python-program .py
     PythonHandler TileCache/Service 
     PythonOption TileCacheConfig /var/www/wms-c/tilecache.cfg
     PythonDebug On 

<Directory /var/www/html/pytest/> 
        AddHandler mod_python .py
        PythonHandler mptest
        PythonDebug On 

-------------- next part --------------
# Configuration for MC TileCache

# [cache] section (mandatory!)
# type=DiskCache    (works out of the box)
# base=<full path to cache directory>
# *or*
# type=MemoryCache  (you'll need memcache.py and memcached running!)
# servers=


# [layername] -- all other sections are named layers
# type={MapServerLayer,WMSLayer} 
#   *** if you want to use MapServerLayer, you *must* have Python mapscript
#       installed and available ***
# mapfile=<full path to map file>   *** only applies to MapServerLayer  ***
# url=<full URL of WMS>             *** only applies to WMSLayer        ***
# layers=<layer>[,<layer2>,<layer3>,...] 
#                                   *** optional iff layername if what
#                                       your data source calls the layer **
# extension={png,jpeg,gif}          *** defaults to "png"               ***
# size=256,256                      *** defaults to 256x256             ***
# bbox=-180.0,-90.0,180.0,90.0      *** defaults to world in lon/lat    ***
# srs=EPSG:4326                     *** defaults to EPSG:4326           ***
# levels=20                         *** defaults to 20 zoom levels      ***
# resolutions=0.1,0.05,0.025,...    *** defaults to global profile      ***
# metaTile=true                     *** metatiling off by default
#                                       requires python-imaging         ***
# metaSize=5,5                      *** size of metatile in tiles
#                                       defaults to 5 x 5               ***
# metaBuffer=10                     *** size of metatile buffer in px   ***





More information about the dev mailing list