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,26 +16,46 @@ for entry in $data; do
continue continue
fi fi
name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'` case "$section" in
type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'` "Rivers")
coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'` name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
if [[ "$type" == "district" ]]; then type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
continue; coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
fi if [[ "$name" != "" && "$coord" != "" ]]; then
if [[ "$name" != "" && "$coord" != "" ]]; then echo "{ \"type\": \"Feature\",
echo "{ \"type\": \"Feature\", \"geometry\": {
\"geometry\": { \"type\": \"LineString\",
\"type\": \"Polygon\", \"coordinates\": [
\"coordinates\": [[ $coord
$coord ]
]] },
}, \"properties\": {
\"properties\": { \"name\": \"$name\",
\"name\": \"$name\", \"type\": \"$type\"
\"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
echo "{ \"type\": \"Feature\",
\"geometry\": {
\"type\": \"Polygon\",
\"coordinates\": [[
$coord
]]
},
\"properties\": {
\"name\": \"$name\",
\"type\": \"$type\"
}
},"
fi
;;
esac
done done
export IFS=" " export IFS=" "
echo "{}" echo "{}"