Added initial version of KML to Tiles converter

This commit is contained in:
2026-07-24 00:06:24 -03:00
commit f2d0917b92
11 changed files with 790 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
root_dir="$(cd -- "$script_dir/.." && pwd)"
cd "$root_dir"
export HTTP_PORT="${HTTP_PORT:-18080}"
base_url="http://127.0.0.1:${HTTP_PORT}"
cleanup() {
docker compose stop tiles >/dev/null 2>&1 || true
}
trap cleanup EXIT
docker compose build tile-builder tiles
docker compose run --rm --no-deps tile-builder --source-filter Altis.kmz
tile_path="$(docker compose run --rm --no-deps --entrypoint sh tile-builder -c 'find /var/lib/arma-tiles/tiles -type f -name "*.png" | head -n 1')"
docker compose run --rm --no-deps --entrypoint sh tile-builder -c 'test -s /var/lib/arma-tiles/tiles/metadata.json'
test -n "$tile_path"
relative="${tile_path#/var/lib/arma-tiles/tiles/}"
IFS=/ read -r z x filename <<<"$relative"
y="${filename%.png}"
docker compose up -d --no-deps tiles
for _ in $(seq 1 20); do
if curl -sS -o /dev/null "$base_url/tiles/$x/$y/$z"; then
break
fi
sleep 1
done
headers="$(curl -sS -D - -o /dev/null "$base_url/tiles/$x/$y/$z")"
printf '%s\n' "$headers" | grep -qi '^HTTP/.* 200'
printf '%s\n' "$headers" | grep -qi '^Content-Type: image/png'
test "$(curl -sS -o /dev/null -w '%{http_code}' "$base_url/tiles/0/0/0")" = "404"
printf 'Smoke test passou: /tiles/%s/%s/%s retornou PNG e tile descoberta retornou 404.\n' "$x" "$y" "$z"