I have gone through the following tutorial to start a map server on Fedora 28:


Although the tutorial is a bit old, most of the steps work fine. Basically we do the following:

  1. Install and start postgresql-server and postgis
  2. Create and setup database named gis and user name apache with all privileges granted on geometry_columns and spatial_ref_sys
  3. Build osm2pgsql from source
  4. Get a region data (in osm format)
  5. Import the osm data into gis using ./osm2pgsql -S ./default.style ../region.osm
  6. Install mapnik:
    yum install mapnik mapnik-devel mapnik-python proj-epsg
  7. Checkout mapnik data from source:
    svn co http://svn.openstreetmap.org/applications/rendering/mapnik
  8. Download coatline data and some other 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 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

  1. Unpack files and setup mapnik environment.

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 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'

  1. Run the script generate_tiles.py (A slightly modified version of it in fact).
    Almost all steps are successful on Fedora 28, except the last step which gives me the following error:

[postgres@localhost mapnik]$ ./z0_generate_tiles.py /usr/lib64/python2.7/site-packages/mapnik2/init.py:27: DeprecationWarning: mapnik2 module has been deprecated, please use 'import mapnik' warnings.warn(msg, DeprecationWarning) render_tiles( (-180.0, -90.0, 180.0, 90.0) /var/lib/pgsql/mapnik/osm.xml /var/lib/pgsql/mapnik/tiles/ 0 0 World ) Traceback (most recent call last): File "./z0_generate_tiles.py", line 215, in render_tiles(bbox, mapfile, tile_dir, 0, 0, "World") File "./z0_generate_tiles.py", line 136, in render_tiles renderer = RenderThread(tile_dir, mapfile, queue, printLock, maxZoom) File "./z0_generate_tiles.py", line 64, in init mapnik.load_map(self.m, mapfile, True) RuntimeError: XML document not well formed: Entity 'prefix' not defined at line 4064 of '/var/lib/pgsql/mapnik/osm.xml'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.