Merge master

This commit is contained in:
Pieter Vander Vennet 2024-04-02 19:07:11 +02:00
commit 890816d2dd
424 changed files with 40595 additions and 3354 deletions

View file

@ -190,10 +190,25 @@ class GenerateBuildDbScript extends Script {
}
async main(args: string[]) {
const allNeededLayers = new ValidateThemeEnsemble().convertStrict(
const allLayers = new ValidateThemeEnsemble().convertStrict(
AllKnownLayouts.allKnownLayouts.values()
)
if (allLayers.size === 0) {
throw "No layers found at all"
}
const notCounted: string[] = []
const allNeededLayers: Map<string, { tags: TagsFilter; foundInTheme: string[] }> = new Map<
string,
{ tags: TagsFilter; foundInTheme: string[] }
>()
for (const key of allLayers.keys()) {
const layer = allLayers.get(key)
if (layer.isCounted) {
allNeededLayers.set(key, layer)
} else {
notCounted.push(key)
}
}
const generators: GenerateLayerLua[] = []
allNeededLayers.forEach(({ tags, foundInTheme }, layerId) => {
@ -210,6 +225,10 @@ class GenerateBuildDbScript extends Script {
const path = "build_db.lua"
fs.writeFileSync(path, script, "utf-8")
console.log("Written", path)
console.log(
"Following layers are _not_ indexed as they are not counted:",
notCounted.join(", ")
)
console.log(
allNeededLayers.size +
" layers will be created with 3 tables each. Make sure to set 'max_connections' to at least " +

View file

@ -0,0 +1,12 @@
#! /bin/bash
cd ~/Downloads
for F in *.osm.pbf
do
LATEST="$F"
done
mv "$LATEST" ~/data/planet-latest.osm.pbf
cd ~/data
osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/mapcomplete-cache planet-latest.osm.pbf
echo "on_data_downloaded.sh has finished!"

8
scripts/osm2pgsql/update.sh Executable file
View file

@ -0,0 +1,8 @@
#! /bin/bash
npm run init
npm run generate
npm run refresh:layeroverview
npm run generate:buildDbScript
mv build_db.sh ~/data/
transmission-cli https://planet.osm.org/pbf/planet-latest.osm.pbf.torrent -f ./on_data_downloaded.sh &>nohup_transmission.log