docker-bastion/examples/osm-taxiways/bin/taxiways-export

21 lines
768 B
Plaintext
Raw Normal View History

#!/bin/sh
# Run the OSM taxiway export for one ICAO (osmium/ogr2ogr/jq over the Europe PBF).
# Broker rule: `taxiways-export [A-Z]{4}`. Writes <ICAO>-taxiways.geojson into the
# osm-maps dir. This takes MINUTES on a cold cache.
#
# The ICAO is re-validated here (defence in depth — the allowlist already pins
# it to [A-Z]{4}, and the broker exec's us shell-free so $1 can't be an operator).
set -eu
OSM_DIR=/osm-maps
icao="${1:-}"
case "$icao" in
[A-Z][A-Z][A-Z][A-Z]) ;;
*) echo "invalid ICAO: '$icao'" >&2; exit 2 ;;
esac
cd "$OSM_DIR" 2>/dev/null || { echo "osm-maps dir not mounted at $OSM_DIR" >&2; exit 4; }
[ -x ./export-icao-geojson.sh ] || { echo "export-icao-geojson.sh missing in $OSM_DIR" >&2; exit 5; }
exec ./export-icao-geojson.sh "$icao"