From 05238dc5aec332970a082b84d174240c4262e95d Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Mon, 27 Apr 2020 17:37:12 +0200 Subject: Add categories for markers This commit obsoletes the many fetch scripts and combines them into a single script, creating a single json, but with category information. --- scripts/geojson/fetch_single.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100755 scripts/geojson/fetch_single.sh (limited to 'scripts/geojson/fetch_single.sh') diff --git a/scripts/geojson/fetch_single.sh b/scripts/geojson/fetch_single.sh deleted file mode 100755 index ce37b59..0000000 --- a/scripts/geojson/fetch_single.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -json=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=$1&rvsection=0&rvslots=main" 2>/dev/null | sed -s "s/\\\\\\\\n//g"` - -title=`echo $json | sed -n 's/.*"title":\s*"\([^"]\+\).*/\1/p'` - -img=$(curl "https://wiki.linux-forks.de/mediawiki/index.php/$1" 2>/dev/null | sed s/\"/\\n/g | grep /thumb/ | head -n 1) - -image="https://wiki.linux-forks.de$img" - -coords=`echo "$json" | sed -n "s/.*coordinates = {{Co|\([^}]*\).*/\1/p"` -coord_x=`echo "$coords" | sed -n "s/\([^|]\+\).*/\1/p"` -coord_y=`echo "$coords" | sed -n "s/.*|\([^|]\+\).*/\1/p"` - -description=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=parse&page=$1§ion=0&prop=text&format=json" 2>/dev/null | sed -z -n "s/<\/p>

//g;s/.*

\(.*\)<\/p>.*/\1/p" | sed s,\"/mediawiki/index.php,\"https://wiki.linux-forks.de/mediawiki/index.php,g` - - -if [[ "$coord_x" != "" && "$coord_y" != "" ]]; then - echo "{\ - \"type\": \"Feature\",\ - \"properties\": {\ - \"name\": \"$title\",\ - \"amenity\": \"City\",\ - \"description\": \"$description\",\ - \"image\": \"$image\"\ - },\ - \"geometry\": {\ - \"type\": \"Point\",\ - \"coordinates\": [$coord_x, $coord_y]\ - }\ - }," -fi -- cgit v1.2.3