|
|
|
|
@ -1,13 +1,12 @@
|
|
|
|
|
# code based on https://developer.here.com/blog/understanding-geocoding-with-python
|
|
|
|
|
#
|
|
|
|
|
# copy or rename to loc.py and add api key
|
|
|
|
|
# copy or rename to loc-foxtelem.py and add api key
|
|
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
|
|
|
|
|
URL = "https://geocode.search.hereapi.com/v1/geocode"
|
|
|
|
|
print("In order to track satellites, we need to know your location\n")
|
|
|
|
|
print("You can enter your state or country or region\n")
|
|
|
|
|
print("as your exact location is not needed. \n\n")
|
|
|
|
|
print("In order to upload your satellite telemetry data to the AMSAT servers, we need to know your location\n")
|
|
|
|
|
print("Enter your location including country. \n\n")
|
|
|
|
|
location = input("Type your location: ") #taking user input
|
|
|
|
|
api_key = '' # Acquire from developer.here.com
|
|
|
|
|
PARAMS = {'apikey':api_key,'q':location}
|
|
|
|
|
@ -24,22 +23,10 @@ longitude = data['items'][0]['position']['lng']
|
|
|
|
|
print(latitude)
|
|
|
|
|
print(longitude)
|
|
|
|
|
|
|
|
|
|
file = open(r"/home/pi/.config/Gpredict/MyLocation.qth","w+")
|
|
|
|
|
|
|
|
|
|
str1 = "[QTH]\n"
|
|
|
|
|
str2 = "LOCATION=" + location + "\n"
|
|
|
|
|
str3 = "LAT=" + str(latitude) + "\n"
|
|
|
|
|
str4 = "LON=" + str(longitude) + "\n"
|
|
|
|
|
str5 = "ALT=0\n"
|
|
|
|
|
str6 = "WX=\n"
|
|
|
|
|
str7 = "QTH_TYPE=0\n"
|
|
|
|
|
|
|
|
|
|
file.write(str1)
|
|
|
|
|
file.write(str2)
|
|
|
|
|
file.write(str3)
|
|
|
|
|
file.write(str4)
|
|
|
|
|
file.write(str5)
|
|
|
|
|
file.write(str6)
|
|
|
|
|
file.write(str7)
|
|
|
|
|
|
|
|
|
|
file.close()
|
|
|
|
|
#file = open(r"/home/pi/CubeSatSim/groundstation/.profile","w+")
|
|
|
|
|
|
|
|
|
|
latSedStr = 'sed -i "s/latitude=0.0/latitude=' $grid + str(latitude) + '/g" /home/pi/Documents/FITB/FoxTelem.properties'
|
|
|
|
|
print (latSedStr)
|
|
|
|
|
|
|
|
|
|
longSedStr = 'sed -i "s/longitude=0.0/longitude=' $grid + str(longitude) + '/g" /home/pi/Documents/FITB/FoxTelem.properties'
|
|
|
|
|
print (longSedStr)
|
|
|
|
|
|