JA:Mapnik/Installation on Fedora 18
Jump to navigation
Jump to search
The information on this page is quite old, and some parts (such as the reliance on subversion) may need updating. |
Tested at
- July 3, 2013
Installation
- 以前にデータベースサーバをインストールして(rootとして)実行していない場合
yum install postgresql-server
postgresql-setup initdb
systemctl start postgresql
サービスが自動的に開始するように設定します。
systemctl enable postgresql
- postgres postgis拡張機能をインストールします(rootとして)
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.
- 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/ne_10m_populated_places.zip
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.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 ne_10m-populated-places.zip -d world_boundaries
unzip ne_110m-admin-0-boundary-lines_land.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