summaryrefslogtreecommitdiff
path: root/scripts/geojson
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/geojson')
-rw-r--r--scripts/geojson/cities.json14
-rwxr-xr-xscripts/geojson/fetch_cities.sh10
-rwxr-xr-xscripts/geojson/fetch_single.sh29
3 files changed, 53 insertions, 0 deletions
diff --git a/scripts/geojson/cities.json b/scripts/geojson/cities.json
new file mode 100644
index 0000000..d66fd89
--- /dev/null
+++ b/scripts/geojson/cities.json
@@ -0,0 +1,14 @@
+[
+{ "type": "Feature", "properties": { "name": "Anju Crossing", "amenity": "City", "description": "Anju Crossing is {{Player|Anju64}}'s settlement, located north of [[Spawn]].", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e//250px-" }, "geometry": { "type": "Point", "coordinates": [-337, 403] } },
+{ "type": "Feature", "properties": { "name": "Crossroads", "amenity": "City", "description": "Crossroads is a city built by {{Player|Ywang}} and some contributors.", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e//250px-" }, "geometry": { "type": "Point", "coordinates": [1771, 991] } },
+{ "type": "Feature", "properties": { "name": "Fatamorgan City", "amenity": "City", "description": "Fatamorgan City is a hamlet situated south of [[Newton]].", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/Fatamorgan_aerial.jpeg/250px-Fatamorgan_aerial.jpeg" }, "geometry": { "type": "Point", "coordinates": [-742, -1421] } },
+{ "type": "Feature", "properties": { "name": "Neverbuild", "amenity": "City", "description": "Neverbuild is an city founded in the Lava/Savannah biome.", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/Neverbuild_panorama.png/250px-Neverbuild_panorama.png" }, "geometry": { "type": "Point", "coordinates": [1350, 1940] } },
+{ "type": "Feature", "properties": { "name": "Origin", "amenity": "City", "description": "Origin is a coastal city built around the world origin of coordinates, managed by {{Player|Felfa}}.", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e//250px-" }, "geometry": { "type": "Point", "coordinates": [0, 0] } },
+{ "type": "Feature", "properties": { "name": "Personhood", "amenity": "City", "description": "Personhood is a major city in the northeast of the map and the previous beginner area.", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/Personhood.png/250px-Personhood.png" }, "geometry": { "type": "Point", "coordinates": [1532, 2971] } },
+{ "type": "Feature", "properties": { "name": "Riverside", "amenity": "City", "description": "Riverside is a city located south of [[Spawn]].", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e//250px-" }, "geometry": { "type": "Point", "coordinates": [-600, -787] } },
+{ "type": "Feature", "properties": { "name": "South Forest", "amenity": "City", "description": "South Forest is a former noob town managed by {{Player|dhausmig}}; it was the first noob town.", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e//250px-" }, "geometry": { "type": "Point", "coordinates": [285, -2045] } },
+{ "type": "Feature", "properties": { "name": "Spawn", "amenity": "City", "description": "Spawn is the capital of the Linux Works minetest server world.", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e//250px-" }, "geometry": { "type": "Point", "coordinates": [-675, -496] } },
+{ "type": "Feature", "properties": { "name": "Stallmangrad", "amenity": "City", "description": "", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/Stallmangrad_dec_2018.png/250px-Stallmangrad_dec_2018.png" }, "geometry": { "type": "Point", "coordinates": [1896, -2205] } },
+{ "type": "Feature", "properties": { "name": "Trisiston", "amenity": "City", "description": "", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/Trisiston_rathaus.png/250px-Trisiston_rathaus.png" }, "geometry": { "type": "Point", "coordinates": [-4250, -3130] } },
+{ "type": "Feature", "properties": { "name": "X Nihilo City", "amenity": "City", "description": "X Nihilo City is a ghost town in the far north of the map, at the end of the [[X Nihilo Mainline]].", "image": "https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/File:XNihilo.png/250px-File:XNihilo.png" }, "geometry": { "type": "Point", "coordinates": [2246, 5942] } },
+{}]
diff --git a/scripts/geojson/fetch_cities.sh b/scripts/geojson/fetch_cities.sh
new file mode 100755
index 0000000..16e81c1
--- /dev/null
+++ b/scripts/geojson/fetch_cities.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+json=`curl 'https://wiki.linux-forks.de/mediawiki/api.php?action=query&format=json&list=categorymembers&cmtitle=Category:City&cmlimit=100'`
+cities=`echo "$json" | json_reformat | sed -n 's/.*"title":\s*"\([^"]*\).*/\1/p' | tr ' ' '_' | tr '\n' ' '`
+
+echo "["
+for city in $cities; do
+ ./fetch_single.sh "$city"
+done
+echo "{}]"
diff --git a/scripts/geojson/fetch_single.sh b/scripts/geojson/fetch_single.sh
new file mode 100755
index 0000000..61ab79d
--- /dev/null
+++ b/scripts/geojson/fetch_single.sh
@@ -0,0 +1,29 @@
+#!/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" | sed -s "s/\\\\\\\\n//g"`
+
+title=`echo $json | sed -n 's/.*"title":\s*"\([^"]\+\).*/\1/p'`
+image=`echo "$json" | sed -n "s/.*image = \([^|]*\).*/\1/p"`
+
+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=`echo $json | sed -n "s/.*coordinates.*[^']*'''\([^']*\)'''\([^\.]*\).*/\1\2./p"
+`
+
+if [[ "$coord_x" != "" && "$coord_y" != "" ]]; then
+ echo "{\
+ \"type\": \"Feature\",\
+ \"properties\": {\
+ \"name\": \"$title\",\
+ \"amenity\": \"City\",\
+ \"description\": \"$description\",\
+ \"image\": \"https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/$image/250px-$image\"\
+ },\
+ \"geometry\": {\
+ \"type\": \"Point\",\
+ \"coordinates\": [$coord_x, $coord_y]\
+ }\
+ },"
+fi