35 lines
1.9 KiB
Bash
Executable File
35 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
echo "Started..."
|
|
#Started...
|
|
DB_NAME="osm_poi"
|
|
DB_USER="osm_poi"
|
|
HIS_HOST="zvbn-his.de"
|
|
HIS_USER="zvbn_steckbrief"
|
|
HIS_DB="his"
|
|
#
|
|
#import P+R and B+R data from HIS into tabelle infra.brpr
|
|
psql -d $DB_NAME -U $DB_USER -c "DELETE FROM infra.brpr;"
|
|
psql -h $HIS_HOST -U $HIS_USER -d $HIS_DB -f /home/${DB_USER}/sql/poi/export_pr_br_02.sql| psql -U $DB_USER -d $DB_NAME -c "COPY infra.brpr(id,kat,name,strasse,plz,gemeinde_his,gemeinde,landkreis,x_gk3,y_gk3,anlage_erkennbar,stellplaetze,emob,betreiber,linien) FROM STDIN WITH DELIMITER AS '|' CSV ;"
|
|
#
|
|
psql -U $DB_USER -f /home/${DB_USER}/sql/poi/vw_poi_fahrplaner_17.sql -d $DB_NAME
|
|
psql -U $DB_USER -c 'DROP VIEW IF EXISTS public.vw_export_poi;' -d $DB_NAME
|
|
psql -U $DB_USER -c 'DROP TABLE IF EXISTS public.tbl_poi_fahrplaner;' -d $DB_NAME
|
|
psql -U $DB_USER -c 'CREATE TABLE tbl_poi_fahrplaner AS SELECT * FROM vw_poi_fahrplaner;' -d $DB_NAME
|
|
#TODO What is the reason for the following instruction?
|
|
psql -U $DB_USER -c 'CREATE INDEX ind_gemeinde ON public.tbl_poi_fahrplaner USING btree (gemeinde)' -d $DB_NAME
|
|
#
|
|
#create VIEW public.vw_export_poi for the POI export(OSM, BR, PR, VVK)
|
|
psql -U $DB_USER -d $DB_NAME -f /home/${DB_USER}/sql/poi/gesamtexport_poi_br_pr_vv_10.sql
|
|
#
|
|
#create exports (second call is for Leaflet map view which uses different separators)
|
|
psql -U $DB_USER -d $DB_NAME -c "COPY (SELECT * FROM public.vw_export_poi) TO STDOUT WITH DELIMITER AS ';' CSV HEADER NULL '' QUOTE '\"';" -o /home/${DB_USER}/osm_poi/osm_poi.csv
|
|
#TODO Required? psql -U $DB_USER -d $DB_NAME -c "COPY (SELECT * FROM public.vw_export_poi) TO STDOUT WITH DELIMITER AS '^' CSV HEADER NULL '' QUOTE '\"' FORCE QUOTE website,oeffnungszeiten;" -o /home/${DB_USER}/osm_poi/osm_poi_ll.csv
|
|
#
|
|
#copy files from tmp folder to server main folger
|
|
cp /home/${DB_USER}/osm_poi/osm_poi.csv /var/www/poi_utf8_demo.csv
|
|
#TODO Required? cp /home/${DB_USER}/osm_poi/osm_poi_ll.csv /var/www/osm_poi_ll_utf8.csv
|
|
#
|
|
echo "Done."
|
|
#done.
|