scripts: Fix geotype for bodies of water

This commit is contained in:
Markus Koch 2021-03-22 18:30:50 +01:00
parent 7a52d5bb59
commit 215e607cb7

View File

@ -16,12 +16,30 @@ for entry in $data; do
continue continue
fi fi
case "$section" in
"Rivers")
name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'` name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'` type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'` coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
if [[ "$type" == "district" ]]; then if [[ "$name" != "" && "$coord" != "" ]]; then
continue; echo "{ \"type\": \"Feature\",
\"geometry\": {
\"type\": \"LineString\",
\"coordinates\": [
$coord
]
},
\"properties\": {
\"name\": \"$name\",
\"type\": \"$type\"
}
},"
fi fi
;;
"Oceans, Seas, and Lakes")
name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
if [[ "$name" != "" && "$coord" != "" ]]; then if [[ "$name" != "" && "$coord" != "" ]]; then
echo "{ \"type\": \"Feature\", echo "{ \"type\": \"Feature\",
\"geometry\": { \"geometry\": {
@ -34,8 +52,10 @@ for entry in $data; do
\"name\": \"$name\", \"name\": \"$name\",
\"type\": \"$type\" \"type\": \"$type\"
} }
}," },"
fi fi
;;
esac
done done
export IFS=" " export IFS=" "
echo "{}" echo "{}"