User:Aharvey/FOSM/Local Mapnik Render
Currently fosm.org lacks a central render. Here I describe the steps I took to set up my own local mapnik render on debian unstable.
1. Obtaining and replicating OSM data for rendering
FOSM started accepting edits serveral months prior to the Jun 2011 OSM.org lockout. Because I assume that there weren't any real substantial edits prior to the OSM.org lockout I start by importing a planet extract from osm.org, then apply the fosm.org diffs from then. You may wish to tweak this date though.
wget https://planet.openstreetmap.org/planet-110621.osm.bz2
I then use the http://m.m.i24.cc/osmconvert.c tool to trim the planet to a bbox. You can use osmosis, but I think this program is faster.
nice bunzip2 -c planet-110621.osm.bz2 | ./osmchange -b=140.822754,-37.037640,159.016113,-28.709861 >sydney-110621.osm
Next I do a bulk download of the fosm planet minute-replicate .osc.gz files. (note: you'll want to replace the 456 with whatever the latest is now)
curl --create-dirs -o minute-replicate/100/#1/#2.osc.gz http://fosm.org/planet/minute-replicate/100/[000-456]/[000-999].osc.gz
2. osm2pgsql
Next we want to import the planet extract and the minute-replicate files into a postgres database suited for rendering using osm2pgsql.
You can't just follow these line by line. See Mapnik/PostGIS. I used (but I've had to build postgis-1.5 myself)
sudo -u postgres -i -H createuser -SdR osmuser createdb -E UTF8 -O osmuser osm createlang plpgsql osm # don't load contrib/_int.sql if you used osm2pgsql-64 psql -d osm -f /usr/share/postgresql/9.0/contrib/hstore.sql psql -d osm -f /usr/share/postgresql/9.0/contrib/postgis-1.5/postgis.sql psql -d osm -f /usr/share/postgresql/9.0/contrib/postgis-1.5/spatial_ref_sys.sql psql osm -c "ALTER TABLE geometry_columns OWNER TO osmuser" psql osm -c "ALTER TABLE spatial_ref_sys OWNER TO osmuser" psql osm -c "ALTER TABLE geography_columns OWNER TO osmuser" exit
I'm not sure if you can use osm2pgsql or you need to use osm2pgsql-64, but I used the 64 one (with this patch http://lists.openstreetmap.org/pipermail/dev/2011-June/023002.html).
~/bin/osm2pgsql --bbox 140.822754,-37.037640,159.016113,-28.709861 --create --database osm --slim --username osmuser --hstore-all
Then load in all our minute-replicate files...
nice ~/bin/osm2pgsql --bbox 140.822754,-37.037640,159.016113,-28.709861 --append --database osm --slim --username osmuser --hstore-all minute-replicate/100/*/*.osc.gz
This brings your osm2pgsql postgres database current up to now. Ideally we would like to automate something to keep it current. I use my two scripts at [1] to do this. I have simply invoked it using
while sleep 120 do update-mirror.sh done
3. mod_tile/tirex
You should be able to follow other guides from here on. I have managed to get tirex working with mod_tile with the standard OSM mapnik stylesheet, all based on our fosm data from the last two steps. I manually expire the tiles via rm -R * inside /var/lib/tirex/tiles/fosm/.