Add recommended indexes for Carto style (thanks @souladm)
This commit is contained in:
parent
d7c2817f9f
commit
9b2b67b076
@ -140,6 +140,7 @@ RUN chown -R postgres:postgres /var/lib/postgresql \
|
|||||||
|
|
||||||
# Start running
|
# Start running
|
||||||
COPY run.sh /
|
COPY run.sh /
|
||||||
|
COPY indexes.sql /
|
||||||
ENTRYPOINT ["/run.sh"]
|
ENTRYPOINT ["/run.sh"]
|
||||||
CMD []
|
CMD []
|
||||||
|
|
||||||
|
48
indexes.sql
Normal file
48
indexes.sql
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
-- 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
4
run.sh
@ -38,6 +38,10 @@ if [ "$1" = "import" ]; then
|
|||||||
|
|
||||||
# Import data
|
# Import data
|
||||||
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua -C 2048 --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style /data.osm.pbf
|
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua -C 2048 --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style /data.osm.pbf
|
||||||
|
|
||||||
|
# Create indexes
|
||||||
|
sudo -u postgres psql -d gis -f indexes.sql
|
||||||
|
|
||||||
service postgresql stop
|
service postgresql stop
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user