Skip to content

Instantly share code, notes, and snippets.

@kd7lxl
Last active November 11, 2021 00:07
Show Gist options
  • Save kd7lxl/4319495980185cee9f037a91ba816199 to your computer and use it in GitHub Desktop.
Save kd7lxl/4319495980185cee9f037a91ba816199 to your computer and use it in GitHub Desktop.
Runs signalserver and converts the output to a kmz file
#!/bin/bash
while read line
do
echo $line
if [[ $line == Writing* ]]
then
while IFS='"' read -ra writingline
do
filename=${writingline[1]%.*}
done <<< $line
fi
if [[ $line == \|* ]]
then
while IFS='|' read -ra coords
do
cat << EOF > doc.kml
<?xml version="1.0" encoding="UTF-8"?>
<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">
<GroundOverlay>
<name>${filename}</name>
<Icon>
<href>${filename}.png</href>
</Icon>
<LatLonBox>
<north>${coords[1]}</north>
<east>${coords[2]}</east>
<south>${coords[3]}</south>
<west>${coords[4]}</west>
</LatLonBox>
</GroundOverlay>
</kml>
EOF
done <<< $line
fi
done
zip "${filename}" "${filename}.png" "doc.kml"
mv "${filename}".zip "${filename}".kmz
echo Generated "${filename}".kmz
#!/bin/bash
set -e
if [[ $# -eq 0 ]] ; then
echo Usage:
echo $0 -lat 46.4879 -lon -123.2144 -txh 60 -f 145 -erp 30 -rxh 5 -R 80 -o outfile | ./genkmz.sh
echo The last argument must be the output name.
exit 1
fi
for name; do true; done
#time ./signalserverHD -sdf $SRTM1DIR -dbm -rt -107 -pm 1 -dbg $@ 2>&1
time ./signalserver -sdf $SRTM3DIR -dbm -rt -107 -pm 1 -dbg $@ 2>&1
# to resize, add: -resize 7000x7000\>
convert $name.ppm -transparent white $name.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment