summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/geojson/maps/fetch_bodiesofwater.sh60
1 files changed, 40 insertions, 20 deletions
diff --git a/scripts/geojson/maps/fetch_bodiesofwater.sh b/scripts/geojson/maps/fetch_bodiesofwater.sh
index 0a2f589..8cd4a29 100755
--- a/scripts/geojson/maps/fetch_bodiesofwater.sh
+++ b/scripts/geojson/maps/fetch_bodiesofwater.sh
@@ -16,26 +16,46 @@ for entry in $data; do
continue
fi
- 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 [[ "$type" == "district" ]]; then
- continue;
- fi
- if [[ "$name" != "" && "$coord" != "" ]]; then
- echo "{ \"type\": \"Feature\",
- \"geometry\": {
- \"type\": \"Polygon\",
- \"coordinates\": [[
- $coord
- ]]
- },
- \"properties\": {
- \"name\": \"$name\",
- \"type\": \"$type\"
- }
-},"
- fi
+ case "$section" in
+ "Rivers")
+ 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\": \"LineString\",
+ \"coordinates\": [
+ $coord
+ ]
+ },
+ \"properties\": {
+ \"name\": \"$name\",
+ \"type\": \"$type\"
+ }
+ },"
+ 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
export IFS=" "
echo "{}"