#!/bin/sh # Given a directory and a 4 Lat/Lon coordinates for that image # look for subdirectories named 1, 2, 3, 4 and traverse them, # creating superoverlay images. # To create the directory hierarchy, run subdivide2 first. # We assume the subdirectories have this layout: # 0 1 # 2 3 # and that each subdirectory has a file called img.png. # Edit dicekml to point to this script. FIXME: there must be a better way. dicekml=c:/cxh/src/fg/bmearth/dice3/dicekml # Error checking if [ ! -x $dicekml ]; then echo "$0: Can't find myself, edit $0 and set dicekml" exit 4 fi if [ $# -ne 4 ]; then echo "$0: usage: $0 north south east west" echo "for example:" echo "$0 40.786612 40.740281 -119.199895 -119.271914" echo "$0 40.7868993953 40.7405683953 -119.199614647 -119.271633647" exit 2 fi north=$1 south=$2 east=$3 west=$4 minLodPixels=460 # N/S and E/W Center points northSouthCenter=`echo foo | awk '{printf("%3.20f\n",(north + south)/2.0)}' north=${north} south=${south}` eastWestCenter=`echo foo | awk '{printf("%3.20f\n",(east + west)/2.0)}' east=${east} west=${west}` echo "dicekml creating `pwd`/doc.kml" #echo "`pwd`: $north $south $east $west" if [ -d 1 ]; then # Go in to the subdirectories # Create the doc.kml file for this level cat > doc.kml < $north$south $east$west 0-1 1 $north$northSouthCenter $east$eastWestCenter $minLodPixels-1 1/doc.kml onRegion 0 $north$northSouthCenter $eastWestCenter$west $minLodPixels-1 0/doc.kml onRegion 3 $northSouthCenter$south $east$eastWestCenter $minLodPixels-1 3/doc.kml onRegion 2 $northSouthCenter$south $eastWestCenter$west 0.0000000.000000 $minLodPixels-1 2/doc.kml onRegion 21 img.png $north$south $east$west EOF (cd 0; $dicekml $north $northSouthCenter $eastWestCenter $west) (cd 1; $dicekml $north $northSouthCenter $east $eastWestCenter) (cd 2; $dicekml $northSouthCenter $south $eastWestCenter $west) (cd 3; $dicekml $northSouthCenter $south $east $eastWestCenter) else # We just have one image in this directory, no subdirectories cat > doc.kml < $north$south $east$west 0-1 21 img.png $north$south $east$west EOF fi