Mapnik/Fedora Installation
From OpenStreetMap Wiki
< Mapnik
Other languages — Help us translating this wiki
• Afrikaans • አማርኛ • العربية • অসমীয়া • asturianu • azərbaycanca • български • বাংলা • brezhoneg • bosanski • català • corsu • česky • dansk • Deutsch • Zazaki • ދިވެހިބަސް • Ελληνικά • Esperanto • español • eesti • euskara • فارسی • suomi • français • Frysk • Gaeilge • Kréyòl gwadloupéyen • Gàidhlig • galego • Alemannisch • ગુજરાતી • هَوُسَ • עברית • हिन्दी • hrvatski • Kreyòl ayisyen • magyar • Հայերեն • interlingua • Bahasa Indonesia • Igbo • íslenska • italiano • 日本語 • Basa Jawa • ქართული • қазақша • ភាសាខ្មែរ • ಕನ್ನಡ • 한국어 • Kurdî • Lëtzebuergesch • ລາວ • lietuvių • latviešu • Malagasy • македонски • മലയാളം • मराठी • Bahasa Melayu • Malti • မြန်မာဘာသာ • नेपाली • Nederlands • norsk (nynorsk) • norsk (bokmål) • occitan • Oromoo • ଓଡ଼ିଆ • ਪੰਜਾਬੀ • polski • پښتو • português • português do Brasil • română • română (Moldova) • سنڌي • සිංහල • slovenčina • slovenščina • Soomaaliga • shqip • српски / srpski • svenska • தமிழ் • తెలుగు • тоҷикӣ • ไทย • Türkçe • українська • اردو • oʻzbekcha • Tiếng Việt • Wolof • isiXhosa • Yorùbá • 中文(简体) • 中文(繁體) • isiZulu
Installation on Fedora
Note: Updated for F15 on June 26, 2011
- Install and run the database server if you haven't done this before (as root)
yum install postgresql-server service postgresql initdb service postgresql start
Optionally set the service to start automatically
chkconfig postgresql on
- Install the postgres postgis extension (as root)
yum install postgis
- Setup the database
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.
- Create your OSM working dir and checkout osm2pgsql project
mkdir ~/osm cd ~/osm svn co http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/ cd osm2pgsql
- To build osm2pgsql, follow Osm2pgsql#Fedora
- Download osm data - for example:
wget http://planet.king-nerd.com/planet-090617.osm.bz2
- Import the map.osm into the gis database
cp -r ~/osm/osm2pgsql /tmp cp ~/osm/map.osm /tmp
./osm2pgsql -S ./default.style ../map.osm
- Install mapnik
yum install mapnik mapnik-devel mapnik-python proj-epsg
- Checkout mapnik data from svn
cd ~/osm svn co http://svn.openstreetmap.org/applications/rendering/mapnik
- Download the Coastline data
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
- Files required since June 2010
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
- Unpack them up properly
cd ~/osm/mapnik tar xvzf world_boundaries-spherical.tgz tar xvjf processed_p.tar.bz2 -C world_boundaries tar xvjf shoreline_300.tar.bz2 -C world_boundaries unzip 10m-populated-places.zip -d world_boundaries unzip 110m-admin-0-boundary-lines.zip -d world_boundaries
- Setup the mapnik environment
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'
- Test mapnik
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 '#'
- Copy/run mapnik
cp -r ~/osm/mapnik ~ cd ~/mapnik/ source set-mapnik-env ./z0_generate_tiles.py
- Check file tiles/0/0/0.png is a world map image