From 740702e20fad4e5f6129ce3c11f6cadfdf2b4103 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 15 Jul 2024 01:51:31 +0200 Subject: [PATCH] Update to the docs --- Docs/SettingUpPSQL.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Docs/SettingUpPSQL.md b/Docs/SettingUpPSQL.md index 4dc3c8443..fea5e796c 100644 --- a/Docs/SettingUpPSQL.md +++ b/Docs/SettingUpPSQL.md @@ -1,15 +1,9 @@ # Setting up a synced OSM-server for quick layer access -## Setting up the SQL-server: +## Setting up the SQL-server (only once): `sudo docker run --name some-postgis -e POSTGRES_PASSWORD=password -e POSTGRES_USER=user -d -p 5444:5432 -v /home/pietervdvn/data/pgsql/:/var/lib/postgresql/data postgis/postgis` -Then, connect to this databank with PGAdmin, create a database within it. -Then activate following extensions for this database (right click > Create > Extension): - -- Postgis activeren (rechtsklikken > Create > extension) -- HStore activeren - Increase the max number of connections. osm2pgsql needs connection one per table (and a few more), and since we are making one table per layer in MapComplete, this amounts to a lot. - Open PGAdmin, open the PGSQL-tool (CLI-button at the top) @@ -19,9 +13,16 @@ Increase the max number of connections. osm2pgsql needs connection one per table - Validate with `cat /var/lib/postgresql/data/postgresql.conf | grep "max_connections"` - `sudo docker restart ` +## Create a database in the SQL-server + + +Then, connect to this database with PGAdmin, create a database within it. +- Activate extensions `Postgis` and `HSTore` (right click > Create > Extension): + + ## Create export scripts for every layer -Use `vite-node ./scripts/osm2pgsql/generateBuildDbScript.ts` +Use `npm run build:dbscript` ## Importing data @@ -33,7 +34,10 @@ which will download the data to `~/Downloads` To seed the database: ```` -osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/osm-poi .osm.pbf +nohup osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/osm-poi .osm.pbf >> seeddb.log + +# To see the progress +tail -f seeddb.log ```` Storing properties to table '"public"."osm2pgsql_properties" takes about 25 minutes with planet.osm