summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-04-15 14:50:50 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-04-15 14:50:50 +0200
commit88feb87009bdc301a9998f9c9952b4c847fd2ea1 (patch)
tree5ebf173b1c3146d92c9d53838d5875fee2ab8543
parentfa39762e5ee6d45ad32a65ea3d3fe1c3fc5ea82e (diff)
downloadlifomapserver-88feb87009bdc301a9998f9c9952b4c847fd2ea1.tar.gz
lifomapserver-88feb87009bdc301a9998f9c9952b4c847fd2ea1.tar.bz2
lifomapserver-88feb87009bdc301a9998f9c9952b4c847fd2ea1.zip
unify fetch scripts, add a lot more categories
-rw-r--r--htdocs/mapscript.js6
-rwxr-xr-xscripts/geojson/fetch.sh30
2 files changed, 36 insertions, 0 deletions
diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js
index 35c2547..8ec6a0b 100644
--- a/htdocs/mapscript.js
+++ b/htdocs/mapscript.js
@@ -127,6 +127,12 @@ load_tiles("Satellite (2019-05-04, wrong coords)", 'world-2019-05-04');
load_geojson("Cities", "./geojson/cities.json", "city", "red");
load_geojson("Stations", "./geojson/stations.json", "train", "blue");
load_geojson("Shops", "./geojson/shops.json", "shopping-cart", "green");
+load_geojson("Parks", "./geojson/parks.json", "tree", "darkgreen");
+load_geojson("Libraries", "./geojson/libraries.json", "book-open", "darkblue");
+load_geojson("CW Complexes", "./geojson/cw_complexes.json", "border-all", "black");
+load_geojson("Courts", "./geojson/courts.json", "balance-scale", "black");
+load_geojson("Waterway", "./geojson/waterway.json", "water", "darkblue");
+load_geojson("Train Depots", "./geojson/depots.json", "wrench", "violet");
L.control.scale().addTo(mymap);
diff --git a/scripts/geojson/fetch.sh b/scripts/geojson/fetch.sh
new file mode 100755
index 0000000..5aa98ec
--- /dev/null
+++ b/scripts/geojson/fetch.sh
@@ -0,0 +1,30 @@
+fetch_category () {
+ echo "Fetching $1" > /dev/stderr
+ json=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=query&format=json&list=categorymembers&cmtitle=Category:$1&cmlimit=1000" 2>/dev/null`
+ cities=`echo "$json" | json_reformat | sed -n 's/.*"title":\s*"\([^"]*\).*/\1/p' | tr ' ' '_' | tr '\n' ' '`
+ num=`echo $cities | tr ' ' '\n' | wc -l`
+ i=0
+ echo "["
+ for city in $cities; do
+ let i++
+ echo -n -e "\rFetched $i/$num" > /dev/stderr
+ ./fetch_single.sh "$city"
+ done
+ echo > /dev/stderr
+ echo "{}]"
+}
+
+JSONDIR=../../htdocs/geojson
+
+mkdir -p $JSONDIR
+
+
+fetch_category Shops > $JSONDIR/shops.json
+fetch_category City > $JSONDIR/cities.json
+fetch_category Stations > $JSONDIR/stations.json
+fetch_category Parks > $JSONDIR/parks.json
+fetch_category Libraries > $JSONDIR/libraries.json
+fetch_category "CW_Complexes" > $JSONDIR/cw_complexes.json
+fetch_category Courts > $JSONDIR/courts.json
+fetch_category Waterway > $JSONDIR/waterway.json
+fetch_category Train_Depots > $JSONDIR/depots.json