summaryrefslogtreecommitdiff
path: root/htdocs/geojson
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/geojson')
-rw-r--r--htdocs/geojson/update.php16
-rwxr-xr-xhtdocs/geojson/update_all.sh19
2 files changed, 35 insertions, 0 deletions
diff --git a/htdocs/geojson/update.php b/htdocs/geojson/update.php
new file mode 100644
index 0000000..06e2a13
--- /dev/null
+++ b/htdocs/geojson/update.php
@@ -0,0 +1,16 @@
+<?php
+ $fn = "/tmp/lifo_update_ts";
+ $ctime = time();
+ $ltime = (int)(file_get_contents($fn));
+ $ntime = $ltime + 60*1 * 30;
+ if (isset($_GET['force']))
+ $ntime = 0;
+ if ($ctime > $ntime) {
+ file_put_contents($fn, $ctime);
+ echo "Downloading... ";
+ flush();
+ system("cd /srv/http/maps.linux-forks.de/geojson/; ./update_all.sh");
+ } else {
+ echo "Next update in " . intval(($ntime - $ctime) / 60) . " minutes.";
+ }
+?>
diff --git a/htdocs/geojson/update_all.sh b/htdocs/geojson/update_all.sh
new file mode 100755
index 0000000..e25d843
--- /dev/null
+++ b/htdocs/geojson/update_all.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+function fetch() {
+ if [[ "$3" != "" ]]; then
+ fn="$3"
+ else
+ fn="$1"
+ fi
+ "./fetch_$1.sh" "$2" | json_reformat -m > "$fn.json.tmp"
+ rm -f "$fn.json"
+ mv "$fn.json.tmp" "$fn.json"
+}
+
+fetch streets
+fetch city_outlines
+fetch trainlines "Train Lines"
+fetch trainlines "Access Paths" trainlines_access
+fetch bodiesofwater "Rivers" rivers
+fetch bodiesofwater "Oceans, Seas, and Lakes" oceans