Air Distance and Bearing

As part of a unit on Trigonometry, we review compass and true bearings before working with bearings in Trigonometry problems.
To start this review lesson, we looked at some images from Google Earth.

Bearing 272° Switzerland Neuchatel Airport .- Distance 23.9 Nautical Miles

It is very important in aviation to have knowledge of the nearby airports at any time in flight. The task is the following:

Determine the distance and bearing from an Airplane to the 20 nearest Airports whenever requested. Use the non-commercial data from openflights.org airports.dat as reference.

A request comes from an airplane at position ( latitude, longitude ): ( 46.94797, 7.44745 ). This is the place where the famous Zytglogge Tower (Clock Tower) at Bern Capital of Switzerland is.

{"png":"https://mainfacts.com/media/images/coats_of_arms/ch.png","svg":"https://mainfacts.com/media/images/coats_of_arms/ch.svg"},"startOfWeek":"monday","capitalInfo":{"latlng":[46.92,7.47]},"postalCode":{"format":"####","regex":"^(\d{4})$"}}]

Latitude and Longitude are the units that represent the coordinates at geographic coordinate system.

Task Solution

Your report should contain the following information from table airports.dat (column shown in brackets below):

ICAO Distance Bearing Country Airport


LSZB 2.9 135 Switzerland Bern Belp Airport
//46.914100647,7.497149944309999
LSZP 10.6 323 Switzerland Biel-Kappelen Airport
LSZW 13.1 151 Switzerland Thun Airport
LSZG 14.1 355 Switzerland Grenchen Airport
//"ZHI","LSZG",47.181599,7.41719,1411,1,"E","Europe/Zurich",ts
LSGE 19.1 233 Switzerland Ecuvillens Airport

Name(2), Country(4), ICAO(6), Distance and Bearing calculated from Latitude(7) and Longitude(8).

procedure FindNearest(var testKoors:tDst_Bear;cntAirports,cntNearest:Integer);
var i: Int32;
begin
  Init_MinSol(cntNearest);
  For i:= 0 to cntAirports-1 do Begin
    testKoors.Koor2:= AirPorts[i].Sol_Koor;
    Calc_Dist_bear(testKoors);
    Insert_Sol(testKoors,i);
  end;
end;

Distance is measured in nautical miles (NM). Resolution is 0.1 NM.

Bearing is measured in degrees (°). 0° = 360° = north then clockwise 90° = east, 180° = south, 270° = west. Resolution is 1°.

procedure Out_MinSol;
var
  i: integer;
begin
writeln(' ICAO Distance Bearing Country        Airport');
writeln(' ---- -------- ------- -------------- ---------');
  For i:= 0 to minSols.actidx do
    with AirPorts[minSols.sols[i].AirportIdx] do
      writeln(Format(' %4s %8.1f %7.0f %-14s  %-35s',
                     [Sol_ICAO,
                      Sol_dist_dir.distance*DiaEarth,
                      Sol_dist_dir.bearing*cRadToDeg,
                      Sol_Country,Sol_Name]));
  writeln('');
  writeln(itoa(cntInserts)+' inserts to find them');
end;

The output shows distance and bearing from the point of view, in our example the Zytglogge-Tower. Bearing is the angle to the next airport:

LSZB 2.9 135 Switzerland Bern Belp Airport

3469 ms for reading airports.dat
30531 ms for searching 100 times of 20 nearest out of 7698 airports
202 inserts to find them

Nearest to latitude 46.94797,longitude 7.44745 degrees

1676,”Bern Belp Airport”,”Bern”,”Switzerland”,”BRN”,”LSZB”,46.914100647,7.497149944309999,1674,1,”E”

Thats what the image detector sees:

URL_APILAY = ‘https://api.apilayer.com/image_to_text/url?url=%s’;

{“lang”: “und”, “all_text”: “Coordinates\n50 m\n605101, 195119\n46.90716, 7.50559\n32\nplatzstrasse\n\n…\nP”, “annotations”: [“Coordinates”, “50”, “m”, “605101”, “,”, “195119”, “46.90716”, “,”, “7.50559”, “32”, “platzstrasse”, “”, ““, “…”, “P”]}

On the other side of the runway you see 14 that means 32–18= 14 or 140° in the opposite direction (reciprocal calculation).

ICAO Distance Bearing Country Airport


LSZB 2.9 135 Switzerland Bern Belp Airport
LSZP 10.6 323 Switzerland Biel-Kappelen Airport
LSZW 13.1 151 Switzerland Thun Airport
LSZG 14.1 355 Switzerland Grenchen Airport
LSGE 19.1 233 Switzerland Ecuvillens Airport
LSZJ 20.3 314 Switzerland Courtelary Airport
LSGR 22.2 155 Switzerland Reichenbach Air Base
LSMP 22.7 254 Switzerland Payerne Air Base
LSGN 23.9 272 Switzerland Neuchatel Airport
LSMI 24.1 132 Switzerland Interlaken Air Base
LSTS 27.1 183 Switzerland St Stephan Airport
LSGC 28.0 287 Switzerland Les Eplatures Airport
LSGK 28.8 196 Switzerland Saanen Airport
LSMM 29.8 114 Switzerland Meiringen Airport
LSPO 29.9 37 Switzerland Olten Airport
LSPN 30.7 57 Switzerland Triengen Airport
LSZQ 31.7 328 Switzerland Bressaucourt Airport
LSZO 34.2 65 Switzerland Luzern-Beromunster Airport
LSMA 34.3 90 Switzerland Alpnach Air Base
LSGY 36.0 252 Switzerland Yverdon-les-Bains Airport

202 inserts to find them
mX4 executed: 23/02/2023 13:26:09 Runtime: 0:0:36.103 Memload: 44% use

OpenWeb('https://www.latlong.net/c/?lat='+flots(myKoor.lat/cDegToRad)+
'&long='+flots(myKoor.lon/cDegToRad));

Data: openflights.org/data:  Airport, airline and route data

Script: 1189_Distance_and_Bearing_Bordcomputer.pas Compiled done: 23/02/2023 13:25:35

Source code of the app:

https://sourceforge.net/projects/maxbox/files/Examples/13_General/1189_Distance_and_Bearing_Bordcomputer.pas/download

A good discussion to start thinking about bearings, how they fit into 360°, how standards are used around the world and why true bearings are often used rather than compass bearings and what’s the difference to heading.

[You might also want to read How Runways Are Designated

Max Kleiner, 23/02/2023

Fraction Check
TEE-Time
DB 103 180-6, SNCF 15013, SBB 11160, SNCB 1801, ÖBB 6010.08, Basel 1977
DB 103 193-9, SNCF 15015, SBB 11161, SNCB 1801, ÖBB 6010.07 – ModelMax
TEE Roland TEE 78 Roland mit Re 4/4 II 11159 am 29.03.1971 in Basel SBB – © W. Proske

LS 10529 Paris La Chapelle
E 10 1266 Rheingold

Dubendorf

means 29–18= 11 or 110°
{"lang": "en", "all_text": "search.ch\n0\nDB Delphi Basics x\n\nWebmail :: WelcX\n50 m\n¸search.ch, swisstopo, OpenStreetMap, others\nmaxbox news x\nDirectory\nWeather\nmXScriptasHTMX\nO8 https://map.search.ch/?q=Restaurant+Holding,+Dübendorf,+Ueberlandstr.+271&near=662000,190000&pos=692307,250\nÅ Restaurant Holding, Dübendorf, Ueberlandstr. 271\nIm grossen Stein\nMap / Route\nInbox (3) - max X\nTimetable\nX\nLeisure\nInterrail 2023 - X\nQ\nTV guide\nImage to Text A X S Map of Switzerl X\nkenweg\nCinema\nWeb search\nÖnikenweg\n+\nMore\n>\n|\nMap\nX\nEN 1\n=\n+1\nGue", "annotations": ["search.ch", "0", "DB", "Delphi", "Basics", "x", "", "Webmail", "::", "WelcX", "50", "m", "¸search.ch", ",", "swisstopo", ",", "OpenStreetMap", ",", "others", "maxbox", "news", "x", "Directory", "Weather", "mXScriptasHTMX", "O8", "https://map.search.ch/?q=Restaurant+Holding,+Dübendorf,+Ueberlandstr.+271&near=662000,190000&pos=692307,250", "Å", "Restaurant", "Holding", ",", "Dübendorf", ",", "Ueberlandstr", ".", "271", "Im", "grossen", "Stein", "Map", "/", "Route", "Inbox", "(", "3", ")", "-", "max", "X", "Timetable", "X", "Leisure", "Interrail", "2023", "-", "X", "Q", "TV", "guide", "Image", "to", "Text", "A", "X", "S", "Map", "of", "Switzerl", "X", "kenweg", "Cinema", "Web", "search", "Önikenweg", "+", "More", ">", "|", "Map", "X", "EN", "1", "=", "+1", "Gue"]}

mX4 executed: 19/04/2023 09:12:51 Runtime: 0:0:1.784 Memload: 45% use

As it can be seen the image2text API missed the 29 on the runway so I did a second screenshot with less information to get a second trial:

Duebendorf

Nope, it cant see the angle on the runway:

{"lang": "und", "all_text": "Coordinates\n692113, 250204\n47.39621, 8.65879\nIm grossen Stein", "annotations": ["Coordinates", "692113", ",", "250204", "47.39621", ",", "8.65879", "Im", "grossen", "Stein"]}

mX4 executed: 19/04/2023 09:30:30 Runtime: 0:0:6.747 Memload: 49% use

The solution is to rotate the image to a better angle (but not find the runway marks, he still can’t find it ):

Image rotate
{"lang": "und", "all_text": "Coordinates\n692113, 250204\n47.39621, 8.65879\nIm grossen Stein\nWeg", "annotations": ["Coordinates", "692113", ",", "250204", "47.39621", ",", "8.65879", "Im", "grossen", "Stein", "Weg"]}
Deployment Context

Nearest to latitude -6.08169,longitude 145.39198 degrees

ICAO Distance Bearing Country Airport


AYGA 0.0 0 Papua New Guinea Goroka Airport
AYCH 25.4 278 Papua New Guinea Chimbu Airport
AYMD 57.6 24 Papua New Guinea Madang Airport
AYMH 67.2 283 Papua New Guinea Mount Hagen Kagamuga Airport
AYNZ 84.8 110 Papua New Guinea Nadzab Airport
AYBA 91.5 202 Papua New Guinea Baimuru Airport
AYWD 93.1 286 Papua New Guinea Wapenamanda Airport
AYKT 93.3 156 Papua New Guinea Kaintiba Airport
AYBU 101.2 132 Papua New Guinea Bulolo Airport
AYMN 103.6 268 Papua New Guinea Mendi Airport
AYKK 105.4 220 Papua New Guinea Kikori Airport
AYKM 115.1 169 Papua New Guinea Kerema Airport
AYMR 129.6 262 Papua New Guinea Moro Airport
AYTA 146.5 275 Papua New Guinea Tari Airport
AYSS 176.5 238 Papua New Guinea Sasereme Airport
AYWK 181.9 325 Papua New Guinea Wewak International Airport
AYBM 188.1 231 Papua New Guinea Balimo Airport
AYDU 222.2 216 Papua New Guinea Daru Airport
AYBD 226.4 143 Papua New Guinea Bodinumu Airport
AYKQ 227.9 144 Papua New Guinea Kagi Airport

168 inserts to find them
mX4 executed: 25/04/2023 12:59:43 Runtime: 0:0:29.240 Memload: 53% use

Goroka Airport
maXbox challenge
Motion Matrix
Real Time Systems Scripting RTSS
maXbox to work

Want to translate your Text then try this Python Script that uses the Deep-translator module which lets you use any Translator in the below example I used Google Translate to translate text

Published by maxbox4

Code till the End

3 thoughts on “Air Distance and Bearing

  1. History of OpenAPI
    The OpenAPI Initiative was created in 2015 by a consortium of 10 technology-centric companies and remains an open governance structure under the Linux Foundation. The consortium was led by SmartBear and also includes 3Scale, Apigee, Capital One, Google, IBM, Intuit, Microsoft, PayPal and Restlet.

    Like

Leave a comment

Design a site like this with WordPress.com
Get started