Last active
July 15, 2025 10:00
-
-
Save naogify/4ba0c2e48057947275590eec43c0253f to your computer and use it in GitHub Desktop.
S3に MVT(Mapbox Vector Tile / xyz 形式)をアップロードするスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -ex | |
| # --- NOTE: S3の設定 --- | |
| # aws configure set default.s3.max_concurrent_requests 100 を指定することで、 | |
| # S3へのアップロードを並列で行うことができます。必要に応じてデフォルト値を変更してください。 | |
| # 1番目の引数がなければエラー | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <UPLOAD_DIR> <S3_BUCKET_URL>" | |
| exit 1 | |
| fi | |
| # 2番目の引数がなければエラー | |
| if [ -z "$2" ]; then | |
| echo "Usage: $0 <UPLOAD_DIR> <S3_BUCKET_URL>" | |
| exit 1 | |
| fi | |
| UPLOAD_DIR="$1" | |
| # UPLOAD_DIR は "./" を付けない | |
| if [[ "$UPLOAD_DIR" == "./"* ]]; then | |
| UPLOAD_DIR="${UPLOAD_DIR:2}" | |
| fi | |
| S3_BUCKET="$2" | |
| # PBFファイル | |
| aws s3 sync "./$UPLOAD_DIR" "$S3_BUCKET/$UPLOAD_DIR" \ | |
| --exclude "*" --include "*.pbf" \ | |
| --content-type "application/vnd.mapbox-vector-tile" \ | |
| --content-encoding gzip \ | |
| --no-progress | |
| # JSONファイル | |
| aws s3 sync "./$UPLOAD_DIR" "$S3_BUCKET/$UPLOAD_DIR" \ | |
| --exclude "*" --include "*.json" \ | |
| --content-type "application/json" \ | |
| --no-progress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment