#!/bin/sh # B16: импорт Беларуси в PostGIS (гибкий стиль osm2pgsql, SRID 4326) # RAM 2ГБ: -C 800 (node cache), --slim без keep-coastlines; number-processes 2 set -e PG="docker exec -i vector-postgres" $PG psql -U postgres -d vector_mchs -c "DROP TABLE IF EXISTS planet_osm_line, planet_osm_point, planet_osm_polygon, planet_osm_roads, osm2pgsql_properties CASCADE;" >/dev/null 2>&1 || true # pbf внутри контейнера: монтируем /tmp через docker cp (проще, чем volume) docker cp /tmp/belarus-latest.osm.pbf vector-postgres:/tmp/belarus.osm.pbf docker exec vector-postgres sh -c "osm2pgsql --slim --drop --create \ -H localhost -P 5432 -U postgres -W -d vector_mchs \ --cache 800 --number-processes 2 -S /usr/share/osm2pgsql/default.style \ /tmp/belarus.osm.pbf" 2>&1 | tail -12 echo "=== tables:" docker exec vector-postgres psql -U postgres -d vector_mchs -t -c "SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'planet_osm%';" docker exec vector-postgres psql -U postgres -d vector_mchs -t -c "SELECT 'roads', count(*) FROM planet_osm_line WHERE highway IS NOT NULL UNION ALL SELECT 'water', count(*) FROM planet_osm_polygon WHERE (landuse='reservoir' OR \"natural\"='water' OR waterway IS NOT NULL) UNION ALL SELECT 'forest', count(*) FROM planet_osm_polygon WHERE landuse='forest' OR \"natural\"='wood' UNION ALL SELECT 'settlements', count(*) FROM planet_osm_point WHERE place IN ('village','town','city');"