Mapnik/Fedora Installation

From OpenStreetMap Wiki
Jump to: navigation, search
Help
Available languages
English Русский

Installation on Fedora

Note: Updated for F15 on June 26, 2011

   yum install postgresql-server
   service postgresql initdb
   service postgresql start

Optionally set the service to start automatically

   chkconfig postgresql on
   yum install postgis

optionally, set password for the database user (as root)

   passwd postgres

otherwise run "su - postgres" as root

   su - postgres
   createdb -EUNICODE gis
   createuser -S -D -R apache
   echo "GRANT ALL ON SCHEMA PUBLIC TO apache;" | psql gis
   psql gis < /usr/share/pgsql/contrib/postgis-64.sql
   psql gis < /usr/share/pgsql/contrib/spatial_ref_sys.sql
   echo "grant all on geometry_columns to apache;" | psql gis
   echo "grant all on spatial_ref_sys to apache;" | psql gis

Note - on a 32 bit system change postgis-64.sql to postgis.sql on the 6th line above.

   mkdir ~/osm
   cd ~/osm
   svn co http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/
   cd osm2pgsql
   wget http://planet.king-nerd.com/planet-090617.osm.bz2
   cp -r ~/osm/osm2pgsql /tmp
   cp ~/osm/map.osm /tmp
   ./osm2pgsql -S ./default.style ../map.osm
   yum install mapnik mapnik-devel mapnik-python proj-epsg
   cd ~/osm
   svn co http://svn.openstreetmap.org/applications/rendering/mapnik
   wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz
   wget http://tile.openstreetmap.org/processed_p.tar.bz2
   wget http://tile.openstreetmap.org/shoreline_300.tar.bz2
   wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/10m-populated-places.zip 
   wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/110m-admin-0-boundary-lines.zip
   cd ~/osm/mapnik
   tar xvzf world_boundaries-spherical.tgz
   tar xvjf processed_p.tar.bz2 -C world_boundaries
   tar xvjf shoreline_300.tar.bz -C world_boundaries
   unzip 10m-populated-places.zip -d world_boundaries
   unzip 110m-admin-0-boundary-lines.zip -d world_boundaries
   cd ~/osm/mapnik
   cp archive/set-mapnik-env .
   vim set-mapnik-env
   change "export MAPNIK_DBNAME='osm'" to 'gis'
   change "export MAPNIK_DBUSER=`whoami`" to 'apache'
   cp ~/osm/mapnik/generate_tiles.py ~/osm/mapnik/z0_generate_tiles.py
   vim ~/osm/mapnik/z0_generate_tiles.py
   #-------------------------------------------------------------------------
   #
   # Change the following for different bounding boxes and zoom levels
   #
   # Start with an overview
   # World
   bbox = (-180.0,-90.0, 180.0,90.0)
   
   render_tiles(bbox, mapfile, tile_dir, 0, 5, "World")
   Change the 5 to 0, then
   Comment out all of the render_tiles line that follows with a '#'
   cp -r ~/osm/mapnik ~
   cd ~/mapnik/
   source set-mapnik-env
   ./z0_generate_tiles.py 
Personal tools
Namespaces
Variants
Actions
site
Toolbox