#!/bin/bash

bbox=$1

if [ -z "${bbox}" ]; then
    echo "Usage: $0 [BBOX_FILE|BBOX_NAME]" > /dev/stderr
    exit 1
fi

if [ ! -e "${bbox}" ]; then
    bbox=inputs/bbox/${bbox}.bbox
fi

if [ ! -e "${bbox}" ] || [ ! -r "${bbox}" ]; then
    echo "File ${bbox} does not exist or is not readable." > /dev/stderr
fi

cat ${bbox} | tr "," " " | xargs printf "bottom=%f left=%f top=%f right=%f"
