Use indexes.sql included with openstreetmap-carto instead of own copy (fixes #204) (#205)

This commit is contained in:
Alexander Overvoorde 2021-07-19 22:05:18 +02:00 committed by GitHub
parent 85eaca5c79
commit 7b82bcae9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 53 deletions

View File

@ -79,7 +79,7 @@ RUN apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ && rm -rf /var/lib/{apt,dpkg,cache,log}/
# Install python libraries # Install python libraries
RUN pip3 install requests \ RUN pip3 install requests \
&& pip3 install pyyaml && pip3 install pyyaml
# Set up PostGIS # Set up PostGIS
@ -132,7 +132,7 @@ RUN mkdir -p /home/renderer/src \
&& cd openstreetmap-carto \ && cd openstreetmap-carto \
&& rm -rf .git \ && rm -rf .git \
&& npm install -g carto@0.18.2 \ && npm install -g carto@0.18.2 \
&& carto project.mml > mapnik.xml && carto project.mml > mapnik.xml
# Configure renderd # Configure renderd
RUN sed -i 's/renderaccount/renderer/g' /usr/local/etc/renderd.conf \ RUN sed -i 's/renderaccount/renderer/g' /usr/local/etc/renderd.conf \
@ -178,7 +178,6 @@ RUN mkdir -p /home/renderer/src \
# Start running # Start running
COPY run.sh / COPY run.sh /
COPY indexes.sql /
ENTRYPOINT ["/run.sh"] ENTRYPOINT ["/run.sh"]
CMD [] 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;

4
run.sh
View File

@ -76,8 +76,8 @@ 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} 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 # 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 #Import external data
sudo chown -R renderer: /home/renderer/src 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 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