From 44e2ff4f468c3ade5233be31fa363cb792fac5cb Mon Sep 17 00:00:00 2001 From: romeo-golf Date: Sat, 14 Jan 2017 03:20:16 +0000 Subject: [PATCH] ADSB Exchange Feeder - Limit derived elevation to 2 decimal places --- bash/feeders/adsbexchange.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/feeders/adsbexchange.sh b/bash/feeders/adsbexchange.sh index 3480b2f..d239338 100755 --- a/bash/feeders/adsbexchange.sh +++ b/bash/feeders/adsbexchange.sh @@ -152,7 +152,7 @@ done # Ask the user to confirm the receivers altitude, this will be prepopulated by the altitude returned from the Google Maps API. RECEIVER_ALTITUDE_TITLE="Receiver Altitude" while [[ -z "${RECEIVER_ALTITUDE}" ]] ; do - DERIVED_ALTITUDE=$(curl -s https://maps.googleapis.com/maps/api/elevation/json?locations=${RECEIVER_LATITUDE},${RECEIVER_LONGITUDE} | python -c "import json,sys;obj=json.load(sys.stdin);print obj['results'][0]['elevation'];") + DERIVED_ALTITUDE=$(curl -s https://maps.googleapis.com/maps/api/elevation/json?locations=${RECEIVER_LATITUDE},${RECEIVER_LONGITUDE} | python -c "import json,sys;obj=json.load(sys.stdin);print obj['results'][0]['elevation'];" | awk '{printf("%.2f\n", $1)}') RECEIVER_ALTITUDE=$(whiptail --backtitle "${ADSB_PROJECTTITLE}" --backtitle "${BACKTITLETEXT}" --title "${RECEIVER_ALTITUDE_TITLE}" --nocancel --inputbox "\nEnter your receiver's altitude, the following values is obtained from google but should be increased to reflect your antennas height above ground level:" 11 78 -- "${DERIVED_ALTITUDE}" 3>&1 1>&2 2>&3) RECEIVER_ALTITUDE_TITLE="Receiver Altitude (REQUIRED)" done