Repository Public
1#!/bin/bash2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : KA Maps Engine8# File : sdk/ios/Scripts/make-test-pack.sh9# Module : sdk10# Repository : https://git.spboucher.ai/ka-maps-engine11# Created : 2026-12-0112# Last Modified : 2026-12-0113#14# Author : Simon-Pierre Boucher15# Position : Professor of Finance16# Institution : Université du Québec en Outaouais (UQO)17# Organization : SP Boucher18# Website : https://spboucher.ai19# Git : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License : None specified (no license file in this repository)32#33# Do not embed credentials, private keys, access tokens,34# certificates or confidential personal information.35#36# =============================================================================37# END OF SP BOUCHER SOURCE HEADER38# =============================================================================3940# Fabrique une archive PMTiles d'essai (Val-d'Or, z0 à z14) à partir des vraies tuiles du service, pour41# éprouver le téléchargement d'archives tant que /v1/pack/index.json est vide.42# Usage : make-test-pack.sh <dossier-de-sortie> → <dossier>/essai.pmtiles43set -euo pipefail44OUT="${1:?dossier de sortie}"45REPO="$(cd "$(dirname "$0")/../../.." && pwd)"46TILES="${KAMAPS_TILES:-https://tiles.spboucher.ai}"47W=-77.8328; S=48.0675; E=-77.7328; N=48.127548mkdir -p "$OUT/tiles"49BIN=(cargo run -q --manifest-path "$REPO/engine/Cargo.toml" -p km-ffi --example make_pack --)50"${BIN[@]}" list $W $S $E $N 0 14 > "$OUT/list.txt"51n=052while read -r t; do53 f="$OUT/tiles/$t.mvt"54 mkdir -p "$(dirname "$f")"55 # --compressed : le service répond en gzip ; l'outil veut les octets MVT bruts. 204 = tuile sans contenu.56 code=$(curl -s --compressed -m 30 -o "$f" -w '%{http_code}' "$TILES/v1/base/$t.mvt")57 [ "$code" = 200 ] || rm -f "$f"58 n=$((n + 1))59done < "$OUT/list.txt"60"${BIN[@]}" write "$OUT/tiles" $W $S $E $N 0 14 "$OUT/essai.pmtiles"61echo "$n tuiles demandées → $OUT/essai.pmtiles ($(stat -f %z "$OUT/essai.pmtiles") octets)"62