Skip to content

Commit

Permalink
Fix merge_mbtiles for non-existant source files
Browse files Browse the repository at this point in the history
  • Loading branch information
keichan34 committed Feb 3, 2024
1 parent d87999a commit 70a960a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions bin/merge_mbtiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,30 @@
#引数を取得
MUNICIPALITY_CODE=${1}

# mbtilesを統合
# smartcity_shape と smartcity_csv は元データが無ければ生成されないので、存在しない場合は統合しない

MBTILES_LIST=()
if [ -f ./smartcity_shape.mbtiles ]; then
MBTILES_LIST+=("./smartcity_shape.mbtiles")
fi
if [ -f ./smartcity_csv.mbtiles ]; then
MBTILES_LIST+=("./smartcity_csv.mbtiles")
fi
if [ -f ./smartcity_municipality_mask.mbtiles ]; then
MBTILES_LIST+=("./smartcity_municipality_mask.mbtiles")
fi

if [ ${#MBTILES_LIST[@]} -eq 0 ]; then
echo "No mbtiles to merge."
exit 1
fi

echo "Merging ${MBTILES_LIST[@]} into ./$MUNICIPALITY_CODE.mbtiles"

tile-join \
--force \
--overzoom \
--no-tile-size-limit \
-o ./$MUNICIPALITY_CODE.mbtiles \
./smartcity_shape.mbtiles \
./smartcity_csv.mbtiles \
./smartcity_municipality_mask.mbtiles
"${MBTILES_LIST[@]}"

0 comments on commit 70a960a

Please sign in to comment.