@ -10,30 +10,28 @@ import maidenhead as mh
latitude = 0
latitude = 0
longitude = 0
longitude = 0
location = " QTH "
location = " My Location "
grid = " "
grid = " "
return_value = 0
return_value = 0
altitude = 0
altitude = 0
dquote = ' \\ " '
dquote = ' \\ " '
print ( " \n In order to track the satellites as they fly over your location and upload your satellite telemetry data to the AMSAT servers, we need to know your location " )
print ( " \n In order to track the satellites as they fly over your location and upload your satellite telemetry data to the AMSAT servers, you need to set your location. " )
print ( " \n You can enter: \n " )
print ( " \n You can enter: \n " )
print ( " 1. Location name (e.g. country or city, state, etc) " )
print ( " 1. Location name (e.g. country or city, state, etc) " )
print ( " 2. Grid square (e.g. FM29ha) " )
print ( " 2. Grid square (e.g. FM29ha) " )
print ( " 3. Latitude and longitude " )
print ( " 3. Latitude and longitude " )
print ( " 4. No location \n " )
print ( " 4. Leave location unchanged \n " )
choice = input ( " Enter your choice (1 - 4): " )
choice = input ( " Enter your choice (1 - 4): " )
if ( choice == ' 2 ' ) :
if ( choice == ' 2 ' ) :
print ( " \n NOTE: To set Gpredict location using Grid square, run Gpredict and select Edit/Preferences/Ground Stations " )
regex = ' [A-Za-z]+[A-Za-z]+[0-9]+[0-9]+[A-Za-z]+[A-Za-z] '
regex = ' [A-Za-z]+[A-Za-z]+[0-9]+[0-9]+[A-Za-z]+[A-Za-z] '
for i in list ( range ( 3 ) ) :
for i in list ( range ( 3 ) ) :
grid = input ( " \n Type your 6 character character grid square (i.e. FM29ha): " )
grid = input ( " \n Enter your 6 character character grid square (i.e. FM29ha): " )
if re . search ( regex , grid ) :
if re . search ( regex , grid ) :
print ( " grid is valid! " )
print ( " grid is valid! " )
@ -41,6 +39,7 @@ if (choice == '2'):
print ( mh . to_location ( grid ) [ 1 ] )
print ( mh . to_location ( grid ) [ 1 ] )
latitude = mh . to_location ( grid ) [ 0 ]
latitude = mh . to_location ( grid ) [ 0 ]
longitude = mh . to_location ( grid ) [ 1 ]
longitude = mh . to_location ( grid ) [ 1 ]
location = input ( " \n Enter the name of your location (or hit Return to leave blank): " )
break
break
else :
else :
print ( " grid is not valid! " )
print ( " grid is not valid! " )
@ -49,7 +48,7 @@ if (choice == '2'):
elif ( choice == ' 3 ' ) :
elif ( choice == ' 3 ' ) :
for i in list ( range ( 3 ) ) :
for i in list ( range ( 3 ) ) :
lat = input ( " \n Type your latitude : " )
lat = input ( " \n Type your latitude (South is negative) :" ) : " )
try :
try :
latitude = float ( lat )
latitude = float ( lat )
print ( latitude )
print ( latitude )
@ -58,19 +57,20 @@ elif (choice == '3'):
print ( " Not a number! " )
print ( " Not a number! " )
for i in list ( range ( 3 ) ) :
for i in list ( range ( 3 ) ) :
long = input ( " \n Type your longitude : " )
long = input ( " \n Type your longitude (West is negative): " ) : " )
try :
try :
longitude = float ( long )
longitude = float ( long )
print ( longitude )
print ( longitude )
break
break
except ValueError :
except ValueError :
print ( " Not a number! " )
print ( " Not a number! " )
location = input ( " \n Enter the name of your location (or hit Return to leave blank): " )
elif ( choice == ' 1 ' ) :
elif ( choice == ' 1 ' ) :
URL = " https://geocode.search.hereapi.com/v1/geocode "
URL = " https://geocode.search.hereapi.com/v1/geocode "
print ( " \n Enter your location including country. \n \n " )
#print("\nEnter your location including country. \n\n" )
location = input ( " Type your location : " ) #taking user input
location = input ( " Enter your location including country : " ) #taking user input
api_key = ' ' # Acquire from developer.here.com
api_key = ' ' # Acquire from developer.here.com
PARAMS = { ' apikey ' : api_key , ' q ' : location }
PARAMS = { ' apikey ' : api_key , ' q ' : location }
@ -88,10 +88,10 @@ elif (choice == '1'):
print ( longitude )
print ( longitude )
except :
except :
print ( " There is a problem with the location API. Please try again " )
print ( " There is a problem with the location API. Try setting your location by latitude and longitude or grid square. " )
else :
else :
print ( " \n You have chosen not to enter you r location." )
print ( " \n You r location is unchanged ." )
print ( " To track satellites and upload telemetry data, " )
print ( " To track satellites and upload telemetry data, " )
print ( " you can set your location in Settings in FoxTelem. " )
print ( " you can set your location in Settings in FoxTelem. " )