forked from shortbread-tiles/shortbread-tilemaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-shapefiles.sh
executable file
·29 lines (24 loc) · 1012 Bytes
/
get-shapefiles.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/bash
set -euo pipefail
function download_and_extract {
URL=$1
FILE=$2
START_DIR=$(pwd)
cd data
echo "Downloading $URL"
curl -z "$FILE" -LO "$URL"
unzip -o -u "$FILE"
cd "$START_DIR"
}
function transform_shp {
FILE=$1
OUT_FILE=$2
ogr2ogr -f "ESRI Shapefile" "$OUT_FILE" "$FILE" -t_srs EPSG:4326 -lco ENCODING=utf8
}
cd "$(dirname "$0")" || exit
mkdir -p data
download_and_extract "https://osmdata.openstreetmap.de/download/water-polygons-split-4326.zip" "water-polygons-split-4326.zip"
download_and_extract "https://osmdata.openstreetmap.de/download/simplified-water-polygons-split-3857.zip" "simplified-water-polygons-split-3857.zip"
download_and_extract "https://shortbread.geofabrik.de/shapefiles/admin-points-4326.zip" "admin-points-4326.zip"
mkdir -p data/simplified-water-polygons-split-4326
transform_shp data/simplified-water-polygons-split-3857/simplified_water_polygons.shp data/simplified-water-polygons-split-4326/simplified_water_polygons.shp