determine locator from gps coordinates
This commit is contained in:
parent
bfcbd0265a
commit
41bd018191
@ -287,7 +287,6 @@ aprs_symbols_path = "/opt/aprs-symbols/png"
|
|||||||
|
|
||||||
# === PSK Reporter setting ===
|
# === PSK Reporter setting ===
|
||||||
# enable this if you want to upload all ft8, ft4 etc spots to pskreporter.info
|
# enable this if you want to upload all ft8, ft4 etc spots to pskreporter.info
|
||||||
# this also uses the receiver_qra setting from above, so make sure it contains a correct locator
|
# this also uses the receiver_gps setting from above, so make sure it contains a correct locator
|
||||||
# TODO determine locator from gps coordinates
|
|
||||||
pskreporter_enabled = False
|
pskreporter_enabled = False
|
||||||
pskreporter_callsign = "N0CALL"
|
pskreporter_callsign = "N0CALL"
|
||||||
|
24
owrx/locator.py
Normal file
24
owrx/locator.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
class Locator(object):
|
||||||
|
@staticmethod
|
||||||
|
def fromCoordinates(coordinates, depth=3):
|
||||||
|
|
||||||
|
lat, lon = coordinates
|
||||||
|
|
||||||
|
lon = lon + 180
|
||||||
|
lat = lat + 90
|
||||||
|
|
||||||
|
res = ""
|
||||||
|
res += chr(65 + int(lon / 20))
|
||||||
|
res += chr(65 + int(lat / 10))
|
||||||
|
if depth >= 2:
|
||||||
|
lon = lon % 20
|
||||||
|
lat = lat % 10
|
||||||
|
res += str(int(lon / 2))
|
||||||
|
res += str(int(lat))
|
||||||
|
if depth >= 3:
|
||||||
|
lon = lon % 2
|
||||||
|
lat = lat % 1
|
||||||
|
res += chr(97 + int(lon * 12))
|
||||||
|
res += chr(97 + int(lat * 24))
|
||||||
|
|
||||||
|
return res
|
@ -6,6 +6,7 @@ import socket
|
|||||||
from sched import scheduler
|
from sched import scheduler
|
||||||
from owrx.config import PropertyManager
|
from owrx.config import PropertyManager
|
||||||
from owrx.version import openwebrx_version
|
from owrx.version import openwebrx_version
|
||||||
|
from owrx.locator import Locator
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -143,7 +144,7 @@ class Uploader(object):
|
|||||||
def getReceiverInformation(self):
|
def getReceiverInformation(self):
|
||||||
pm = PropertyManager.getSharedInstance()
|
pm = PropertyManager.getSharedInstance()
|
||||||
callsign = pm["pskreporter_callsign"]
|
callsign = pm["pskreporter_callsign"]
|
||||||
locator = pm["receiver_qra"]
|
locator = Locator.fromCoordinates(pm["receiver_gps"])
|
||||||
decodingSoftware = "OpenWebRX " + openwebrx_version
|
decodingSoftware = "OpenWebRX " + openwebrx_version
|
||||||
body = [b for s in [callsign, locator, decodingSoftware] for b in self.encodeString(s)]
|
body = [b for s in [callsign, locator, decodingSoftware] for b in self.encodeString(s)]
|
||||||
body = self.pad(body, 4)
|
body = self.pad(body, 4)
|
||||||
|
Loading…
Reference in New Issue
Block a user