-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fe4bb5
commit abbeec3
Showing
96 changed files
with
22,703 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!b/bin/bash | ||
#Add paths to run properly through cron | ||
cd /home/username/files/rail_maps_automated | ||
exec 3>&1 4>&2 | ||
trap 'exec 2>&4 1>&3' 0 1 2 3 | ||
exec 1>log.out 2>&1 | ||
/bin/rm /home/username/files/rail_maps_automated/*.txt | ||
/bin/rm /home/username/files/rail_maps_automated/*.csv | ||
#/bin/rm /home/username/files/rail_maps_automated/gtfs.zip | ||
#URL now broken | ||
#/usr/bin/curl 'http://www.gbrail.info/gtfs.zip' -o gtfs.zip | ||
/usr/bin/unzip -o gtfs.zip | ||
/bin/mv stops.txt stops.csv | ||
echo "Time: $(date) Step 1" > logging.txt | ||
PGPASSWORD=pg_pw /usr/bin/psql -U username -d gis -h localhost -p 5432 -a -f 'drop_table.sql' | ||
PGPASSWORD=pg_pw /usr/bin/psql -U username -d gis -h localhost -p 5432 -a -f 'create_tables.sql' | ||
PGPASSWORD=pg_pw /usr/bin/psql -U username -d gis -h localhost -p 5432 -a -f 'copy_data.sql' | ||
/usr/bin/ogr2ogr -f Postgresql pg:"dbname='gis' user='username' password='pg_pw' host='localhost'" -lco GEOMETRY_NAME=geom -lco PRECISION=no -nlt POINT -skipfailures -a_srs EPSG:4326 -nln "ukrail_stops" 'stops.vrt' | ||
PGPASSWORD=pg_pw /usr/bin/psql -U username -d gis -h localhost -p 5432 -a -f 'vacuum_analyze.sql' | ||
PGPASSWORD=pg_pw /usr/bin/psql -U username -d gis -h localhost -p 5432 -a -f 'sql_joins.sql' | ||
PGPASSWORD=pg_pw /usr/bin/psql -U username -d gis -h localhost -p 5432 -a -f 'export_data.sql' | ||
/bin/rm *.txt | ||
/bin/rm dynamic_js/*.js | ||
/usr/bin/ogr2ogr -f GeoJSON dynamic_js/stops.js -lco COORDINATE_PRECISION=4 -sql "SELECT DISTINCT ON (stop_name) stop_name, geom FROM ukrail_stopsgeom ORDER BY stop_name, stop_id DESC" pg:"dbname='gis' user='username' password='postgres' host='localhost'" ukrail_stops | ||
echo "Time: $(date) Step 2" >> logging.txt | ||
/bin/rm agencies_js/*.js | ||
/bin/rm parent_js/*.js | ||
/bin/bash create_json_files_agency.sh | ||
/bin/bash create_json_files_parent.sh | ||
/bin/bash add_json_headers_agencies.sh | ||
/bin/bash add_json_headers_parent.sh | ||
/bin/bash add_json_headers_dynamic_js.sh | ||
/bin/ls parent_js > parent.txt | ||
/bin/ls agencies_js > agencies.txt | ||
/bin/rm agencies.html | ||
/bin/rm parent.html | ||
/usr/bin/python rail_HTML_generator.py -i agencies | ||
/usr/bin/python rail_HTML_generator.py -i parent | ||
/usr/bin/python rail_HTML_generator_mobile.py -i agencies | ||
/usr/bin/python rail_HTML_generator_mobile.py -i parent | ||
/bin/cp /var/www/ukrailmap.co.uk/html/* /home/username/files/rail_maps_automated/www_backup | ||
/bin/cp /home/username/files/rail_maps_automated/agencies.html /home/username/files/rail_maps_automated/parent.html /home/username/files/rail_maps_automated/ukrail_distinct_agencies_parent.html /home/username/files/rail_maps_automated/agencies_mobile.html /home/username/files/rail_maps_automated/parent_mobile.html /home/username/files/rail_maps_automated/ukrail_distinct_agencies_parent.csv /var/www/ukrailmap.co.uk/html/ | ||
echo "Time: $(date) Step 3" >> logging.txt | ||
/bin/rm /var/www/ukrailmap.co.uk/html/agencies_js/* | ||
/bin/cp /home/username/files/rail_maps_automated/agencies_js/* /var/www/ukrailmap.co.uk/html/agencies_js/ | ||
/bin/rm /var/www/ukrailmap.co.uk/html/css/* | ||
/bin/cp -r /home/username/files/rail_maps_automated/css/* /var/www/ukrailmap.co.uk/html/css/ | ||
/bin/rm /var/www/ukrailmap.co.uk/html/dynamic_js/* | ||
/bin/cp /home/username/files/rail_maps_automated/dynamic_js/* /var/www/ukrailmap.co.uk/html/dynamic_js/ | ||
/bin/rm /var/www/ukrailmap.co.uk/html/js/* | ||
/bin/cp /home/username/files/rail_maps_automated/js/* /var/www/ukrailmap.co.uk/html/js/ | ||
/bin/rm /var/www/ukrailmap.co.uk/html/parent_js/* | ||
/bin/cp /home/username/files/rail_maps_automated/parent_js/* /var/www/ukrailmap.co.uk/html/parent_js/ | ||
/bin/rm /var/www/ukrailmap.co.uk/html/static_js/* | ||
/bin/cp /home/username/files/rail_maps_automated/static_js/* /var/www/ukrailmap.co.uk/html/static_js/ | ||
echo "Time: $(date) Step 4 - Done" >> logging.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
# UK_Rail_Map | ||
Map of the uk rail network. Can run weekly to take into account any changes. | ||
|
||
This is very poorly documented. | ||
|
||
This esentailly creates all the files in one folder and then copies the html and js ones to a different one. | ||
|
||
Queries from: | ||
sql_queries_neededing_to_be_created.sql | ||
|
||
Need to be run first. | ||
|
||
And the public.ukrail_manual_agency_parent table needs to be created. This will contain the logic between the parent company and the operator. | ||
|
||
The file in ukrail_manual_agency_parent.backup was accurate in 2017. | ||
|
||
The GTFS files used the generate the map are no longer updated by ATOC. So this will no longer run correctly. But could be modified for other countries. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
cd /home/tseepra/files/rail_maps_automated/parent_js | ||
FILES=*.js | ||
for f in $FILES | ||
do | ||
NAME=$f | ||
FILE2=${NAME::-3} | ||
a='var json_' | ||
b='_parent =' | ||
TEXT=$a$FILE2$b | ||
# take action on each file. $f store current file name | ||
echo $TEXT | cat - $f > temp && mv temp $f | ||
done | ||
cd /home/tseepra/files/rail_maps_automated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
cd /home/tseepra/files/rail_maps_automated/dynamic_js | ||
FILES=*.js | ||
for f in $FILES | ||
do | ||
NAME=$f | ||
FILE2=${NAME::-3} | ||
a='var json_' | ||
b='_dynamic =' | ||
TEXT=$a$FILE2$b | ||
# take action on each file. $f store current file name | ||
echo $TEXT | cat - $f > temp && mv temp $f | ||
done | ||
cd /home/tseepra/files/rail_maps_automated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
cd /home/tseepra/files/rail_maps_automated/agencies_js | ||
FILES=*.js | ||
for f in $FILES | ||
do | ||
NAME=$f | ||
FILE2=${NAME::-3} | ||
a='var json_' | ||
b='_agencies =' | ||
TEXT=$a$FILE2$b | ||
# take action on each file. $f store current file name | ||
echo $TEXT | cat - $f > temp && mv temp $f | ||
done | ||
cd /home/tseepra/files/rail_maps_automated |
Oops, something went wrong.