Skip to content
Snippets Groups Projects
Commit ed5f9ec1 authored by Lionel VIDALLER's avatar Lionel VIDALLER
Browse files

mise en place setup

parent ef1b90d4
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# In[1]: # In[1]:
import sys
import pandas as pd import pandas as pd
import osmium import osmium
...@@ -14,7 +14,7 @@ import osmium ...@@ -14,7 +14,7 @@ import osmium
#fichier_bal = './bal_extrait.csv' #fichier_bal = './bal_extrait.csv'
fichier_bal = './bal_200046977.csv' fichier_bal = './bal_200046977.csv'
fichier_codes = './correspondance-code-insee-code-postal-gl.csv' fichier_codes = './correspondance-code-insee-code-postal-gl.csv'
fichier_pbf = '/app/src/data-sources/osmfile/mdl-latest.osm.pbf' fichier_pbf = sys.argv[1]
# premier indice osm_id dans les données résultat # premier indice osm_id dans les données résultat
......
#!/bin/bash #!/bin/bash
FILE=/app/src/data-sources/osmfile/mdl-latest.osm.pbf OSMFILE=$1
if [ -e "$FILE" ]; then if [ -e "$OSMFILE" ]; then
rm "$FILE" rm "$OSMFILE"
fi fi
echo "::: Creating OSM file... :::" echo "::: Creating OSM file... :::"
python3 bal_2_osm.py python3 bal_2_osm.py $OSMFILE
echo "::: OSM file ready :::" echo "::: OSM file ready :::"
...@@ -6,7 +6,7 @@ services: ...@@ -6,7 +6,7 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
volumes: volumes:
- ./nominatimdata:/app/src/data-sources/osmfile - ./nominatimdata:/app/src/data-sources/osmfile
command: sh osmfile.sh command: sh osmfile.sh /app/src/data-sources/osmfile/mdl-latest.osm.pbf
nominatim: nominatim:
# image: nominatim # image: nominatim
...@@ -23,7 +23,7 @@ services: ...@@ -23,7 +23,7 @@ services:
ports: ports:
- 6432:5432 - 6432:5432
- 7070:8080 - 7070:8080
command: sh /app/init.sh /app/src/data-sources/osmfile/mdl-latest.osm.pbf postgresdata 4 command: sh /app/wait.sh /app/src/data-sources/osmfile/mdl-latest.osm.pbf postgresdata 4
photon: photon:
build: build:
......
...@@ -50,3 +50,4 @@ COPY start.sh /app/start.sh ...@@ -50,3 +50,4 @@ COPY start.sh /app/start.sh
COPY startapache.sh /app/startapache.sh COPY startapache.sh /app/startapache.sh
COPY startpostgres.sh /app/startpostgres.sh COPY startpostgres.sh /app/startpostgres.sh
COPY init.sh /app/init.sh COPY init.sh /app/init.sh
COPY wait.sh /app/wait.sh
...@@ -2,15 +2,6 @@ OSMFILE=$1 ...@@ -2,15 +2,6 @@ OSMFILE=$1
PGDIR=$2 PGDIR=$2
THREADS=$3 THREADS=$3
FILE=/app/src/data-sources/osmfile/mdl-latest.osm.pbf
sleep 5
if [ ! -e "$FILE" ]; then
echo "::: Waiting for OSM file to be ready... :::"
sleep 5
fi
rm -rf /data/$PGDIR && \ rm -rf /data/$PGDIR && \
mkdir -p /data/$PGDIR && \ mkdir -p /data/$PGDIR && \
...@@ -28,5 +19,3 @@ sudo -u nominatim ./src/build/utils/setup.php --osm-file $OSMFILE --all --thread ...@@ -28,5 +19,3 @@ sudo -u nominatim ./src/build/utils/setup.php --osm-file $OSMFILE --all --thread
sudo -u nominatim ./src/build/utils/check_import_finished.php && \ sudo -u nominatim ./src/build/utils/check_import_finished.php && \
sudo -u postgres /usr/lib/postgresql/12/bin/pg_ctl -D /data/$PGDIR stop && \ sudo -u postgres /usr/lib/postgresql/12/bin/pg_ctl -D /data/$PGDIR stop && \
sudo chown -R postgres:postgres /data/$PGDIR sudo chown -R postgres:postgres /data/$PGDIR
sudo sh ./start.sh
OSMFILE=$1
PGDIR=$2
THREADS=$3
sleep 5
if [ ! -e "$OSMFILE" ]; then
echo "::: Waiting for OSM file to be ready... :::"
sleep 5
fi
sudo sh ./init.sh $OSMFILE $PGDIR $THREADS
sudo sh ./start.sh
setup.sh 0 → 100755
#!/bin/bash
### Nominatim ###
# Stop existing containers
docker-compose down
docker-compose rm -f
# Clear existing data
sudo rm -Rf ./nominatimdata && mkdir nominatimdata
sudo rm -Rf ./photondata && mkdir photondata
# Get the Métropole de Lyon database
# wget --directory-prefix=./bal2osm https://download.data.grandlyon.com/files/grandlyon/localisation/bal/bal_200046977.csv
# Generate OSM file
cd bal2osm
docker build -t bal2osm .
docker run -t \
-v `pwd`/../nominatimdata:/data \
bal2osm \
sh osmfile.sh /data/mdl-latest.osm.pbf
cd ..
# Build the image
cd nominatim-3.5
docker build -t nominatim .
cd ..
# Initialize the database
docker run -t \
-v `pwd`/nominatimdata:/data \
nominatim \
sh /app/init.sh /data/mdl-latest.osm.pbf postgresdata 4
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment