#!/bin/bash
# usage:
#   ovl2selection2 kal-directory areas.ovl > mapfilenames
#
# select map file names according to OVL areas (area type / areas defined by polygonal lines)
# like ovl2selection, but here the tile has to lie completely within the borders

if [ $# -ne 2 ]; then
  echo "Syntax:"
  echo "ovl2selection2 kal-directory areas.ovl > mapfilenames"
  exit
fi

hash kal2selection

find "$1" -maxdepth 1 -name '*.kal' -print0 | xargs -0 -I '{}' cat '{}' | kal2selection2 "$2"
