32 lines
954 B
Bash
Executable file
32 lines
954 B
Bash
Executable file
#!/bin/bash
|
|
# scripts/02_import_tiles.sh
|
|
|
|
PBF_FILE="/data/osm/region.osm.pbf"
|
|
PG_CONN="postgresql://maps:maps@postgres:5432/maps"
|
|
|
|
# Clone openmaptiles toolchain (once)
|
|
if [ ! -d "/opt/openmaptiles" ]; then
|
|
git clone https://github.com/openmaptiles/openmaptiles.git /opt/openmaptiles
|
|
fi
|
|
|
|
# Import OSM data into PostGIS using openmaptiles schema
|
|
# This creates the tables that Martin reads for tile generation
|
|
cd /opt/openmaptiles
|
|
|
|
# osm2pgsql import with openmaptiles mapping
|
|
osm2pgsql \
|
|
--create \
|
|
--slim \
|
|
--database "$PG_CONN" \
|
|
--style openmaptiles.style \
|
|
--tag-transform-script lua/tagtransform.lua \
|
|
--number-processes 4 \
|
|
--cache 4096 \
|
|
--flat-nodes /data/osm/nodes.cache \
|
|
"$PBF_FILE"
|
|
|
|
# Run openmaptiles SQL post-processing to create materialized views
|
|
# that Martin serves as tile layers
|
|
psql "$PG_CONN" -f build/openmaptiles.sql
|
|
|
|
echo "Tile data import complete. Martin will serve tiles from PostGIS."
|