8000 Improve location data by chriselsen · Pull Request #15 · snstac/inrcot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Improve location data #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions inrcot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def cli(app_name: str = "inrcot") -> None:

config_file = cli_args.get("CONFIG_FILE")
if config_file and os.path.exists(config_file):
# disable the asyncio "Executing took ... seconds" warning
logging.getLogger('asyncio').setLevel(logging.ERROR)
logging.info("Reading configuration from %s", config_file)
orig_config.read(config_file)
else:
Expand Down
15 changes: 12 additions & 3 deletions inrcot/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from configparser import ConfigParser
from typing import Optional, Set
from pyproj import CRS, Transformer

from aiohttp import BasicAuth

Expand Down Expand Up @@ -117,6 +118,14 @@ def inreach_to_cot_xml(
if not all([lat, lon]):
return None

# Define coordinate reference systems
crs_msl = CRS.from_epsg(5499) # Example: EPSG code for a MSL-based vertical CRS
crs_wgs84 = CRS.from_epsg(4979) # EPSG code for WGS84 (latitude, longitude, ellipsoidal height)

# Create a transformer and transform MSL -> WSG84
transformer = Transformer.from_crs(crs_msl, crs_wgs84)
hae_latitude, hae_longitude, hae_alt = transformer.transform(lat, lon, alt)

time = when

# We want to use localtime + stale instead of lastUpdate time + stale
Expand All @@ -133,9 +142,9 @@ def inreach_to_cot_xml(
callsign = name

point = ET.Element("point")
point.set("lat", str(lat))
point.set("lon", str(lon))
point.set("hae", "9999999.0")
point.set("lat", str(hae_latitude))
point.set("lon", str(hae_longitude))
point.set("hae", str(hae_alt))
point.set("ce", "9999999.0")
point.set("le", "9999999.0")

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def read_readme(readme_file="README.rst") -> str:
long_description_content_type="text/x-rst",
zip_safe=False,
include_package_data=True,
install_requires=["pytak >= 5.6.1", "aiohttp"],
install_requires=["pytak >= 5.6.1", "aiohttp", "pyproj" ],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
Expand Down
0