summaryrefslogblamecommitdiffstats
path: root/iss_above.sh
blob: c5857ab698215d3d520fba0eb30f7191d99d1ed6 (plain) (tree)









































                                                                               
#!/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();