Compare commits

...

6 Commits

Author SHA1 Message Date
Alexander Overvoorde
60ac7657d1 Don't clutter output of usage instructions 2021-09-03 12:51:45 +02:00
Alexander Overvoorde
ce176ae32e Fix erroneous quotes around WGET_ARGS (fixes #210) 2021-09-03 12:46:37 +02:00
Alexander Overvoorde
7b82bcae9d Use indexes.sql included with openstreetmap-carto instead of own copy (fixes #204) (#205) 2021-07-19 22:05:18 +02:00
Jason Montleon
85eaca5c79 Install python-is-python3 for openstreetmap-tiles-update-expire (#201) 2021-07-03 15:28:40 +02:00
Alexander Overvoorde
9679b29b50 Update NodeJS to 14 LTS (#185) 2021-05-13 14:44:24 +02:00
ruhepuls
8f2c575ad6 Carto 5.3.1 integrated (#183) 2021-05-13 14:41:01 +02:00
3 changed files with 18 additions and 59 deletions

View File

@@ -14,7 +14,7 @@ RUN apt-get update \
&& apt-get install -y wget gnupg2 lsb-core apt-transport-https ca-certificates curl \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb [ trusted=yes ] https://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
&& wget --quiet -O - https://deb.nodesource.com/setup_10.x | bash - \
&& wget --quiet -O - https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get update \
&& apt-get install -y nodejs
@@ -62,10 +62,12 @@ RUN apt-get install -y --no-install-recommends \
postgresql-contrib-12 \
postgresql-server-dev-12 \
protobuf-c-compiler \
python-is-python3 \
python3-mapnik \
python3-lxml \
python3-psycopg2 \
python3-shapely \
python3-pip \
sudo \
tar \
ttf-unifont \
@@ -76,6 +78,10 @@ RUN apt-get install -y --no-install-recommends \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
# Install python libraries
RUN pip3 install requests \
&& pip3 install pyyaml
# Set up PostGIS
RUN wget https://download.osgeo.org/postgis/source/postgis-3.1.1.tar.gz -O postgis.tar.gz \
&& mkdir -p postgis_src \
@@ -122,13 +128,11 @@ RUN mkdir -p /home/renderer/src \
# Configure stylesheet
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone --single-branch --branch v5.2.0 https://github.com/gravitystorm/openstreetmap-carto.git --depth 1 \
&& git clone --single-branch --branch v5.3.1 https://github.com/gravitystorm/openstreetmap-carto.git --depth 1 \
&& cd openstreetmap-carto \
&& rm -rf .git \
&& npm install -g carto@0.18.2 \
&& carto project.mml > mapnik.xml \
&& scripts/get-shapefiles.py \
&& rm /home/renderer/src/openstreetmap-carto/data/*.zip
&& carto project.mml > mapnik.xml
# Configure renderd
RUN sed -i 's/renderaccount/renderer/g' /usr/local/etc/renderd.conf \
@@ -174,7 +178,6 @@ RUN mkdir -p /home/renderer/src \
# Start running
COPY run.sh /
COPY indexes.sql /
ENTRYPOINT ["/run.sh"]
CMD []

View File

@@ -1,48 +0,0 @@
-- Extracted from https://github.com/gravitystorm/openstreetmap-carto
-- Comes with a CC0 license
-- These are optional but suggested indexes for rendering OpenStreetMap Carto
-- with a full planet database.
-- This file is generated with scripts/indexes.py
CREATE INDEX planet_osm_roads_admin
ON planet_osm_roads USING GIST (way)
WHERE boundary = 'administrative';
CREATE INDEX planet_osm_roads_roads_ref
ON planet_osm_roads USING GIST (way)
WHERE highway IS NOT NULL AND ref IS NOT NULL;
CREATE INDEX planet_osm_roads_admin_low
ON planet_osm_roads USING GIST (way)
WHERE boundary = 'administrative' AND admin_level IN ('0', '1', '2', '3', '4');
CREATE INDEX planet_osm_line_ferry
ON planet_osm_line USING GIST (way)
WHERE route = 'ferry';
CREATE INDEX planet_osm_line_river
ON planet_osm_line USING GIST (way)
WHERE waterway = 'river';
CREATE INDEX planet_osm_line_name
ON planet_osm_line USING GIST (way)
WHERE name IS NOT NULL;
CREATE INDEX planet_osm_polygon_water
ON planet_osm_polygon USING GIST (way)
WHERE waterway IN ('dock', 'riverbank', 'canal')
OR landuse IN ('reservoir', 'basin')
OR "natural" IN ('water', 'glacier');
CREATE INDEX planet_osm_polygon_nobuilding
ON planet_osm_polygon USING GIST (way)
WHERE building IS NULL;
CREATE INDEX planet_osm_polygon_name
ON planet_osm_polygon USING GIST (way)
WHERE name IS NOT NULL;
CREATE INDEX planet_osm_polygon_way_area_z10
ON planet_osm_polygon USING GIST (way)
WHERE way_area > 23300;
CREATE INDEX planet_osm_polygon_military
ON planet_osm_polygon USING GIST (way)
WHERE (landuse = 'military' OR military = 'danger_area') AND building IS NULL;
CREATE INDEX planet_osm_polygon_way_area_z6
ON planet_osm_polygon USING GIST (way)
WHERE way_area > 5980000;
CREATE INDEX planet_osm_point_place
ON planet_osm_point USING GIST (way)
WHERE place IS NOT NULL AND name IS NOT NULL;

14
run.sh
View File

@@ -1,7 +1,5 @@
#!/bin/bash
set -x
function createPostgresConfig() {
cp /etc/postgresql/12/main/postgresql.custom.conf.tmpl /etc/postgresql/12/main/conf.d/postgresql.custom.conf
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/12/main/conf.d/postgresql.custom.conf
@@ -23,6 +21,8 @@ if [ "$#" -ne 1 ]; then
exit 1
fi
set -x
if [ "$1" = "import" ]; then
# Ensure that database directory is in right state
chown postgres:postgres -R /var/lib/postgresql
@@ -50,10 +50,10 @@ if [ "$1" = "import" ]; then
if [ -n "$DOWNLOAD_PBF" ]; then
echo "INFO: Download PBF file: $DOWNLOAD_PBF"
wget "$WGET_ARGS" "$DOWNLOAD_PBF" -O /data.osm.pbf
wget $WGET_ARGS "$DOWNLOAD_PBF" -O /data.osm.pbf
if [ -n "$DOWNLOAD_POLY" ]; then
echo "INFO: Download PBF-POLY file: $DOWNLOAD_POLY"
wget "$WGET_ARGS" "$DOWNLOAD_POLY" -O /data.poly
wget $WGET_ARGS "$DOWNLOAD_POLY" -O /data.poly
fi
fi
@@ -76,7 +76,11 @@ if [ "$1" = "import" ]; then
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style /data.osm.pbf ${OSM2PGSQL_EXTRA_ARGS}
# Create indexes
sudo -u postgres psql -d gis -f indexes.sql
sudo -u postgres psql -d gis -f /home/renderer/src/openstreetmap-carto/indexes.sql
#Import external data
sudo chown -R renderer: /home/renderer/src
sudo -u renderer python3 /home/renderer/src/openstreetmap-carto/scripts/get-external-data.py -c /home/renderer/src/openstreetmap-carto/external-data.yml -D /home/renderer/src/openstreetmap-carto/data
# Register that data has changed for mod_tile caching purposes
touch /var/lib/mod_tile/planet-import-complete