Skip to content

Commit f057a33

Browse files
committed
Merged in feature/implement-OpenTopoMap (pull request ncareol#1)
Feature/implement OpenTopoMap
2 parents 8d48836 + e8fdd0b commit f057a33

9 files changed

+1539
-34
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker-compose.yml

Dockerfile

+30-23
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@
88
# <http://switch2osm.org/serving-tiles/manually-building-a-tile-server-12-04/>.
99
#
1010

11-
FROM ncareol/baseimage:0.9.18
11+
FROM phusion/baseimage:latest
1212
MAINTAINER Erik Johnson <[email protected]>
1313

14-
# Set the locale. This affects the encoding of the Postgresql template
15-
# databases.
16-
ENV LANG C.UTF-8
17-
RUN update-locale LANG=C.UTF-8
1814

1915
# Ensure `add-apt-repository` is present
2016
RUN apt-get update -y
@@ -23,12 +19,15 @@ RUN apt-get install -y software-properties-common python-software-properties
2319
RUN apt-get install -y libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libboost-thread-dev
2420

2521
# Install remaining dependencies
26-
RUN apt-get install -y subversion git-core tar unzip wget bzip2 build-essential autoconf libtool libxml2-dev libgeos-dev libpq-dev libbz2-dev munin-node munin libprotobuf-c0-dev protobuf-c-compiler libfreetype6-dev libpng12-dev libtiff4-dev libicu-dev libgdal-dev libcairo-dev libcairomm-1.0-dev apache2 apache2-dev libagg-dev liblua5.2-dev ttf-unifont
22+
RUN apt-get install -y subversion git-core tar unzip wget bzip2 build-essential autoconf libtool libxml2-dev libgeos-dev libpq-dev libbz2-dev munin-node munin libprotobuf-c0-dev protobuf-c-compiler libfreetype6-dev libpng12-dev libtiff5-dev libicu-dev libgdal-dev libcairo-dev libcairomm-1.0-dev apache2 apache2-dev libagg-dev liblua5.2-dev ttf-unifont
2723

28-
RUN apt-get install -y autoconf apache2-dev libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal1-dev mapnik-utils python-mapnik libmapnik-dev
24+
RUN apt-get install -y autoconf apache2-dev libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal1-dev sudo
25+
26+
# Install OpenTopoMap dependencies
27+
RUN apt-get install -y python3-setuptools python3-matplotlib python3-bs4 python3-numpy python3-gdal python-gdal
2928

3029
# Install postgresql and postgis
31-
RUN apt-get install -y postgresql-9.3-postgis-2.1 postgresql-contrib postgresql-server-dev-9.3
30+
RUN apt-get install -y postgresql postgresql-contrib postgis postgresql-9.5-postgis-2.2
3231

3332
# Install osm2pgsql
3433
RUN cd /tmp && git clone git://github.com/openstreetmap/osm2pgsql.git && \
@@ -39,17 +38,9 @@ RUN cd /tmp && git clone git://github.com/openstreetmap/osm2pgsql.git && \
3938
make && make install && \
4039
cd /tmp && rm -rf /tmp/osm2pgsql
4140

42-
# TODO: mapnik 3.0.5
4341

4442
# Install the Mapnik library
45-
RUN cd /tmp && git clone git://github.com/mapnik/mapnik && \
46-
cd /tmp/mapnik && \
47-
git checkout 2.2.x && \
48-
python scons/scons.py configure INPUT_PLUGINS=all OPTIMIZATION=3 SYSTEM_FONTS=/usr/share/fonts/truetype/ && \
49-
python scons/scons.py && \
50-
python scons/scons.py install && \
51-
ldconfig && \
52-
cd /tmp && rm -rf /tmp/mapnik
43+
RUN apt-get install -y libmapnik3.0 libmapnik-dev mapnik-utils python-mapnik unifont
5344

5445
# Verify that Mapnik has been installed correctly
5546
RUN python -c 'import mapnik'
@@ -65,12 +56,22 @@ RUN cd /tmp && git clone git://github.com/openstreetmap/mod_tile.git && \
6556
ldconfig && \
6657
cd /tmp && rm -rf /tmp/mod_tile
6758

59+
# Install phyghtmap (OpenTopoMap)
60+
RUN cd /tmp && wget http://katze.tfiu.de/projects/phyghtmap/phyghtmap_2.20.orig.tar.gz && \
61+
tar -xvzf phyghtmap_2.20.orig.tar.gz && \
62+
rm *.gz && \
63+
cd phyghtmap-2.20 && \
64+
python3 setup.py install
65+
6866
# Install the Mapnik stylesheet
6967
RUN cd /usr/local/src && svn co http://svn.openstreetmap.org/applications/rendering/mapnik mapnik-style
7068

7169
# Install the coastline data
7270
RUN cd /usr/local/src/mapnik-style && ./get-coastlines.sh /usr/local/share
7371

72+
# Download OpenTopoMap data
73+
RUN cd /root && git clone https://github.com/der-stefan/OpenTopoMap.git && chmod go+rx /root/ && ln -s /data /root/OpenTopoMap/mapnik/ && chown -R www-data OpenTopoMap
74+
7475
# Configure mapnik style-sheets
7576
RUN cd /usr/local/src/mapnik-style/inc && cp fontset-settings.xml.inc.template fontset-settings.xml.inc
7677
ADD datasource-settings.sed /tmp/
@@ -79,27 +80,32 @@ ADD settings.sed /tmp/
7980
RUN cd /usr/local/src/mapnik-style/inc && sed --file /tmp/settings.sed settings.xml.inc.template > settings.xml.inc
8081

8182
# Configure renderd
82-
ADD renderd.conf.sed /tmp/
83-
RUN cd /usr/local/etc && sed --file /tmp/renderd.conf.sed --in-place renderd.conf
83+
ADD renderd.conf /tmp/
84+
RUN cd /usr/local/etc && mv /tmp/renderd.conf .
8485

8586
# Create the files required for the mod_tile system to run
8687
RUN mkdir /var/run/renderd && chown www-data: /var/run/renderd
8788
RUN mkdir /var/lib/mod_tile && chown www-data /var/lib/mod_tile
8889

8990
# Replace default apache index page with OpenLayers demo
90-
ADD index.html /var/www/html/index.html
91+
ADD www/* /var/www/html/
9192

9293
# Configure mod_tile
9394
ADD mod_tile.load /etc/apache2/mods-available/
9495
ADD mod_tile.conf /etc/apache2/mods-available/
9596
RUN a2enmod mod_tile
9697

9798
# Ensure the webserver user can connect to the gis database
98-
RUN sed -i -e 's/local all all peer/local gis www-data peer/' /etc/postgresql/9.3/main/pg_hba.conf
99+
RUN sed -i -e 's/local all all peer/host all all 0\.0\.0\.0\/0 trust/' /etc/postgresql/9.5/main/pg_hba.conf
100+
RUN echo 'local gis www-data peer' >> /etc/postgresql/9.5/main/pg_hba.conf && \
101+
echo 'local lowzoom www-data peer' >> /etc/postgresql/9.5/main/pg_hba.conf && \
102+
echo 'local postgres www-data peer' >> /etc/postgresql/9.5/main/pg_hba.conf && \
103+
echo 'local template1 www-data peer' >> /etc/postgresql/9.5/main/pg_hba.conf && \
104+
echo 'local contours www-data peer' >> /etc/postgresql/9.5/main/pg_hba.conf
99105

100106
# Tune postgresql
101107
ADD postgresql.conf.sed /tmp/
102-
RUN sed --file /tmp/postgresql.conf.sed --in-place /etc/postgresql/9.3/main/postgresql.conf
108+
RUN sed --file /tmp/postgresql.conf.sed --in-place /etc/postgresql/9.5/main/postgresql.conf
103109

104110
# Define the application logging logic
105111
ADD syslog-ng.conf /etc/syslog-ng/conf.d/local.conf
@@ -121,7 +127,7 @@ RUN update-service --add /etc/sv/renderd
121127
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
122128

123129
# Expose the webserver and database ports
124-
EXPOSE 80 5432
130+
EXPOSE 80 80
125131

126132
# We need the volume for importing data from
127133
VOLUME ["/data"]
@@ -140,5 +146,6 @@ ADD help.txt /usr/local/share/doc/run/help.txt
140146
ADD run.sh /usr/local/sbin/run
141147
ENTRYPOINT ["/sbin/my_init", "--", "/usr/local/sbin/run"]
142148

149+
143150
# Default to showing the usage text
144151
CMD ["help"]

postgresql.conf.sed

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ s/#autovacuum = on/autovacuum = off/
77
s/#log_destination = 'stderr'/log_destination = 'stderr,syslog'/
88
s/#syslog_facility/syslog_facility/
99
s/#syslog_ident/syslog_ident/
10+
s/#listen_addresses = 'localhost'/listen_addresses = '*'/

postgresql/down

100644100755
File mode changed.

postgresql/run

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
# permissions setting.
99
chown -R postgres /var/lib/postgresql/ || exit 1
1010

11-
exec /sbin/setuser postgres /usr/lib/postgresql/9.3/bin/postgres \
12-
-D /var/lib/postgresql/9.3/main \
13-
-c config_file=/etc/postgresql/9.3/main/postgresql.conf
11+
exec /sbin/setuser postgres /usr/lib/postgresql/9.5/bin/postgres \
12+
-D /var/lib/postgresql/9.5/main \
13+
-c config_file=/etc/postgresql/9.5/main/postgresql.conf

renderd.conf

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[renderd]
2+
socketname=/var/run/renderd/renderd.sock
3+
num_threads=4
4+
tile_dir=/var/lib/mod_tile
5+
stats_file=/var/run/renderd/renderd.stats
6+
7+
;[renderd01]
8+
;iphostname=::1
9+
;ipport=7654
10+
;num_threads=4
11+
;tile_dir=rados://tiles/etc/ceph/ceph.conf
12+
;stats_file=/var/run/renderd/renderd.stats
13+
14+
;[renderd02]
15+
;iphostname=::1
16+
;ipport=7654
17+
;num_threads=4
18+
;tile_dir=memcached://
19+
;stats_file=/var/run/renderd/renderd.stats
20+
21+
[mapnik]
22+
plugins_dir=/usr/lib/mapnik/3.0/input
23+
font_dir=/usr/share/fonts/truetype/ttf-dejavu
24+
font_dir_recurse=1
25+
26+
[default]
27+
URI=/osm_tiles/
28+
TILEDIR=/var/lib/mod_tile/PATH_TO_BE_REPLACED
29+
XML=/usr/local/src/mapnik-style/osm.xml
30+
HOST=localhost
31+
TILESIZE=256
32+
;HTCPHOST=proxy.openstreetmap.org
33+
;** config options used by mod_tile, but not renderd **
34+
;MINZOOM=0
35+
;MAXZOOM=18
36+
;TYPE=png image/png
37+
;DESCRIPTION=This is a description of the tile layer used in the tile json request
38+
;ATTRIBUTION=&copy;<a href=\"http://www.openstreetmap.org/\">OpenStreetMap</a> and <a href=\"http://wiki.openstreetmap.org/wiki/Contributors\">contributors</a>, <a href=\"http://opendatacommons.org/licenses/odbl/\">ODbL</a>
39+
;SERVER_ALIAS=http://localhost/
40+
;CORS=http://www.openstreetmap.org
41+
;ASPECTX=1
42+
;ASPECTY=1
43+
;SCALE=1.0
44+
45+
;[style2]
46+
;URI=/osm_tiles2/
47+
;TILEDIR=rados://tiles/etc/ceph/ceph.conf
48+
;TILESIZE=512
49+
;XML=/usr/local/src/mapnik-style/osm.xml
50+
;HOST=localhost
51+
;HTCPHOST=proxy.openstreetmap.org
52+
;** config options used by mod_tile, but not renderd **
53+
;MINZOOM=0
54+
;MAXZOOM=22
55+
;TYPE=png image/png
56+
;DESCRIPTION=This is a description of the tile layer used in the tile json request
57+
;ATTRIBUTION=&copy;<a href=\"http://www.openstreetmap.org/\">OpenStreetMap</a> and <a href=\"http://wiki.openstreetmap.org/wiki/Contributors\">contributors</a>, <a href=\"http://opendatacommons.org/licenses/odbl/\">ODbL</a>
58+
;SERVER_ALIAS=http://localhost/
59+
;CORS=*

renderd.conf.sed

-6
This file was deleted.

0 commit comments

Comments
 (0)