Skip to content

Commit b8f0ae3

Browse files
authored
Update bin/generate-tiles (#409)
- Remove implicit metadata update, as [discussed here](738a64d#comments). - Add BBOX info to log output. - Simplify `(set -x; ...)` syntax.
1 parent b486d9b commit b8f0ae3

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

bin/generate-tiles

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,15 @@ ${NOGZIP:+&nogzip=${NOGZIP}}\
7474
${USE_KEY_COLUMN:+&key=${USE_KEY_COLUMN}}\
7575
${TEST_ON_STARTUP_TILE:+&testOnStartup=${TEST_ON_STARTUP}}"
7676

77-
function run_tilelive_copy() {
78-
set -x -o errexit
77+
function run_tilelive_copy() (
78+
set -x
7979
tilelive-copy "${@}" \
8080
--exit \
8181
--retry="$RETRY" \
8282
--concurrency="$ALL_STREAMS" \
8383
"$PGQUERY" \
8484
"mbtiles://${MBTILES_PATH}"
85-
{ set +x ;} 2> /dev/null
86-
}
85+
)
8786

8887

8988
if [[ -n "${LIST_FILE-}" ]]; then
@@ -95,13 +94,13 @@ if [[ -n "${LIST_FILE-}" ]]; then
9594
elif [[ -z "${MID_ZOOM-}" ]]; then
9695

9796
# One pass zoom - generate all tiles in one pass
98-
echo "$(date '+%Y-%m-%d %H-%M-%S') Generating zoom $MIN_ZOOM..$MAX_ZOOM from $HOST_COUNT servers, using $MAX_HOST_CONNECTIONS connections per server, $ALL_STREAMS parallel streams..."
97+
echo "$(date '+%Y-%m-%d %H-%M-%S') Generating zoom $MIN_ZOOM..$MAX_ZOOM inside (${BBOX}) from $HOST_COUNT servers, using $MAX_HOST_CONNECTIONS connections per server, $ALL_STREAMS parallel streams..."
9998
run_tilelive_copy --scheme="$RENDER_SCHEME" --bounds="$BBOX" --minzoom="$MIN_ZOOM" --maxzoom="$MAX_ZOOM" --timeout="${TIMEOUT:-1800000}"
10099

101100
else
102101

103102
# Generate all tiles up to MID_ZOOM. Afterwards only generate those tiles where zoom-1 is not empty
104-
echo "$(date '+%Y-%m-%d %H-%M-%S') Generating zoom $MIN_ZOOM..$MID_ZOOM pyramid from $HOST_COUNT servers, using $MAX_HOST_CONNECTIONS connections per server, $ALL_STREAMS parallel streams..."
103+
echo "$(date '+%Y-%m-%d %H-%M-%S') Generating zoom $MIN_ZOOM..$MID_ZOOM inside (${BBOX}) from $HOST_COUNT servers, using $MAX_HOST_CONNECTIONS connections per server, $ALL_STREAMS parallel streams..."
105104
run_tilelive_copy --scheme="$RENDER_SCHEME" --bounds="$BBOX" --minzoom="$MIN_ZOOM" --maxzoom="$MID_ZOOM" --timeout="${TIMEOUT:-1800000}"
106105

107106
# Do not print extra info more than once
@@ -110,23 +109,12 @@ else
110109
for (( ZOOM=MID_ZOOM+1; ZOOM<=MAX_ZOOM; ZOOM++ )); do
111110
LIST_FILE="$EXPORT_DIR/tiles_$ZOOM.txt"
112111
echo "$(date '+%Y-%m-%d %H-%M-%S') Imputing tiles for zoom $ZOOM"
113-
set -x
114-
mbtiles-tools impute "$MBTILES_PATH" --zoom "$ZOOM" --output "$LIST_FILE" --verbose
115-
{ set +x ;} 2> /dev/null
112+
(set -x; mbtiles-tools impute "$MBTILES_PATH" --zoom "$ZOOM" --output "$LIST_FILE" --verbose)
116113
echo "$(date '+%Y-%m-%d %H-%M-%S') Generating zoom $ZOOM using a tile list $LIST_FILE from $HOST_COUNT servers, using $MAX_HOST_CONNECTIONS connections per server, $ALL_STREAMS streams"
117114
# Use smaller timeout by default because high zooms should generate faster
118115
run_tilelive_copy --scheme=list "--list=$LIST_FILE" --timeout="${TIMEOUT:-180000}"
119116
done
120117

121118
fi
122119

123-
if [[ -z "${TILESET_FILE:-}" ]]; then
124-
echo "WARNING: Env var TILESET_FILE is not set to a valid tileset yaml file. Skipping metadata generation"
125-
else
126-
echo "$(date '+%Y-%m-%d %H-%M-%S') Updating generated tile metadata from $TILESET_FILE"
127-
set -x
128-
mbtiles-tools meta-generate "$MBTILES_PATH" "$TILESET_FILE" --auto-minmax --show-ranges
129-
{ set +x ;} 2> /dev/null
130-
fi
131-
132120
echo "$(date '+%Y-%m-%d %H-%M-%S') Tile generation complete!"

0 commit comments

Comments
 (0)