-
Notifications
You must be signed in to change notification settings - Fork 0
/
kmlcreate_png.sh
executable file
·71 lines (53 loc) · 2.27 KB
/
kmlcreate_png.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
cd /gtopoData/tpqs/output/
pwd
for quadname in *; do
cd /gtopoData/tpqs/output/$quadname/
pwd
outputfilename=/gtopoData/tpqs/output/$quadname/$quadname"_png.kml"
echo "Output File Name: "$outputfilename
rm $outputfilename
echo "<?xml version="\""1.0"\"" encoding="\""UTF-8"\""?>" >> $outputfilename
echo "<kml xmlns="\""http://www.opengis.net/kml/2.2"\"" xmlns:gx="\""http://www.google.com/kml/ext/2.2"\"" xmlns:kml="\""http://www.opengis.net/kml/2.2"\"" xmlns:atom="\""http://www.w3.org/2005/Atom"\"">" >> $outputfilename
echo "<Folder>" >> $outputfilename
echo "<name>"$quadname"</name>" >> $outputfilename
echo "<open>0</open>" >> $outputfilename
for contour in */;do
cd /gtopoData/tpqs/output/$quadname/$contour
pwd
echo "<Folder>" >> $outputfilename
echo "<name>"$contour"</name>" >> $outputfilename
echo "<open>0</open>" >> $outputfilename
for directory in [0-9]*; do
for filename in $directory/[0-9]*.png; do
echo "Filename: "$filename;
finalfilename=`echo $filename | cut -d '/' -f 2`
echo "Final Filename: "$finalfilename;
nlat=`echo $finalfilename | cut -d '_' -f 1`
slat=`echo $finalfilename | cut -d '_' -f 2`
elong=`echo $filename | cut -d '_' -f 3`
wlong=`echo $filename | cut -d '_' -f 4 | cut -d '.' -f 1-2`
echo "NLat: "$nlat
echo "SLat: "$slat
echo "WLong: "$wlong
echo "ELong: "$elong
echo "<GroundOverlay>" >> $outputfilename
echo "<name>"$nlat"N-"$wlong"W</name>" >> $outputfilename
echo "<Icon>" >> $outputfilename
echo "<href>"$contour"/"$nlat"/"$finalfilename"</href>" >> $outputfilename
echo "<viewBoundScale>0.75</viewBoundScale>" >> $outputfilename
echo "</Icon>" >> $outputfilename
echo "<LatLonBox>" >> $outputfilename
echo "<north>"$nlat"</north>" >> $outputfilename
echo "<south>"$slat"</south>" >> $outputfilename
echo "<east>"$elong"</east>" >> $outputfilename
echo "<west>"$wlong"</west>" >> $outputfilename
echo "</LatLonBox>" >> $outputfilename
echo "</GroundOverlay>" >> $outputfilename
done
done
echo "</Folder>" >> $outputfilename
done
echo "</Folder>" >> $outputfilename
echo "</kml>" >> $outputfilename
done