Processing/LLToBNG: gettiles.sh

File gettiles.sh, 965 bytes (added by benj, 16 years ago)
Line 
1# Script to scan eagle/hawk header files and determine BNG grid squares for the flight
2
3alltiles=""
4
5if [ -d "./eagle" ] ; then
6    cd eagle
7else
8    if [ -d "./hawk" ] ; then
9        cd hawk
10    else
11        echo "No eagle/hawk directories - cannot scan for BNG tiles"
12        exit 1
13    fi
14fi
15dirlist=`ls -1 *.hdr`
16
17for file in $dirlist ; do
18    # Read header file, grep starting point, print 5th and 6th fields (lat/long) and strip unwanted characters
19    posline=`grep 'GPS Starting point' $file | awk '{print $5 " " $6}' | sed 's/[{},]//g'`
20     
21    # Run lat/long through script, strip unwanted characters via grep/awk
22    tile=`ll2bng.sh $posline | grep '[A-Z]\{2\}[0-9]\{2\}$' | awk '{print $3}'`
23
24    posline2=`grep 'GPS Ending point' $file | awk '{print $5 " " $6}' | sed 's/[{},]//g'`
25    tile2=`ll2bng.sh $posline2 | grep '[A-Z]\{2\}[0-9]\{2\}$' | awk '{print $3}'`
26
27    alltiles="$alltiles $tile $tile2"
28done
29cd ..
30
31echo $alltiles | tr ' ' \\n | sort