Skip to content

Deployment

PebblesFTW edited this page Jun 25, 2020 · 12 revisions

Dependencies

Installation

1. Set up mapnik 2.3

Clone the repository of mapnik 2.3:

git clone -b 2.3.x https://github.com/mapnik/mapnik.git

1.1 Install mapnik

Follow the instructions on:
https://github.com/mapnik/mapnik/blob/2.3.x/INSTALL.md

We documented the issues we frequently encountered while setting up mapnik below (Known Issues).

2. Set up Preselected Rendering

Clone this repository:

git clone https://github.com/OpenHistoricalDataMap/Preselected-Rendering.git

2.1 Get world boundaries

mkdir Preselected-Rendering/world_boundaries
cd Preselected-Rendering/world_boundaries

2.1.1 Download the country borders and coastlines shapefiles

wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz # (51M)
wget http://tile.openstreetmap.org/processed_p.tar.bz2 # (391M)
wget http://tile.openstreetmap.org/shoreline_300.tar.bz2 # (42M)
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip # (1.5 MB)
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.zip # (44 KB)

Note: It may be possible that the wget commands will result in an error. If that occurs, just download them manually via the provided links and move them into the world_boundaries directory.

2.1.2 Extract them into the repository

tar -xzf world_boundaries-spherical.tgz
tar -xjf processed_p.tar.bz2
tar -xjf shoreline_300.tar.bz2
unzip ne_10m_populated_places.zip
unzip ne_110m_admin_0_boundary_lines_land.zip

2.1.3 Clean up the archives

rm world_boundaries-spherical.tgz processed_p.tar.bz2 shoreline_300.tar.bz2 ne_10m_populated_places.zip ne_110m_admin_0_boundary_lines_land.zip

2.2 Install psycopg2

This is needed to access a postgres database.

pip install psycopg2

2.3 Customize Settings

You NEED TO customize the following file to match your database configuration.

inc/datasource-settings.xml.inc

You CAN customize the following file to change fontsettings for Mapnik fonts.

inc/fontset-settings.xml.inc

You CAN customize the following file to match your settings for symbols, the spatial reference of your postgis tables and coastline shapefiles directory. You SHOULD NOT however change the <!ENTITY prefix [...]>, because that entry is used by generate_view_tiles.py to access preselected database tables (Views).

inc/settings.xml.inc

You should stick with the recommended defaults unless you know better.

Testing rendering

To generate a simple image of the United Kingdom use the 'generate_image.py' script.

./generate_image.py # will output an 'image.png' file

Known issues

1. Set up mapnik 2.3: Step './configure'

Exiting... the following required dependencies were not found:
- freetype-config (freetype-config program | try setting FREETYPE_CONFIG SCons option or configure with FREETYPE_LIBS & FREETYPE_INCLUDES)
- boost development headers (more info see: https://github.com/mapnik/mapnik/wiki/Mapnik-Installation & http://www.boost.org/)

See '/home/<user>/mapnik/config.log' for details on possible problems.

https://github.com/mapnik/mapnik/issues/3211

Clone this wiki locally