diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2024-02-13 09:49:36 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-02-13 09:49:36 +0100 |
commit | fe846b6fe98ed766bd316642a13ff484e57fe035 (patch) | |
tree | 45594ff2ca48d89b1c40fe6f13430e37502461ee /iss_above.sh | |
parent | 5f4443bbecae1b3fc907cba6116b219036793d68 (diff) | |
download | ISS_Above-fe846b6fe98ed766bd316642a13ff484e57fe035.tar.gz |
First experiments with the shell script
Diffstat (limited to 'iss_above.sh')
-rwxr-xr-x | iss_above.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/iss_above.sh b/iss_above.sh new file mode 100755 index 0000000..c5857ab --- /dev/null +++ b/iss_above.sh @@ -0,0 +1,42 @@ +#!/bin/bash +set -eux + +API_URL='http://api.open-notify.org/iss-now.json' + +API_data=$(curl -s "$API_URL") + +latitude="$(echo $API_data|jq -r '. | .iss_position.latitude')" +longitude="$(echo $API_data|jq -r '. | .iss_position.longitude')" + +my_lat="50.0769160" +my_long="14.4740344" + +. "mirkarte/geo.sh" + +# distance lat1 lon1 lat2 lon2 → metres (rounded to millimetres), error < ¼% +echo "$(distance $latitude $longitude $my_lat $my_long)" + +## +## processResult: function() { +## this.task_queue--; +## +## if (this.task_queue === 0) { +## // print('our location: ' + this.current_location.toSource()); +## // print('iss coordinates: ' + this.iss_coords.toSource()); +## +## let dist = this.get_distance(this.current_location.Latitude, +## this.current_location.Longitude, +## this.iss_coords.iss_position.latitude, +## this.iss_coords.iss_position.longitude) +## +## print('ISS is ' + dist + ' km away.'); +## +## Mainloop.quit(); +## } +## } +##}); +## +##let client = new ISS_Above(); +##client.run(); +## +##Mainloop.run(); |