Flight Historian Version 2.3: Automatic Distance Calculations and GPX/KML Maps

Version 2.3 of Flight Historian is now live.

Automatic Distance Calculations

While a great deal of my flight entry work has been automated since Version 2.1, one outstanding manual entry was the distance associated with a given route between two airports. Flight Historian would automatically add a new route to my Routes table the first time I flew it, but I’d have to manually go back in and add the distance via an Edit Route page.

I decided that it would be a good idea for me to add latitude and longitude fields to my Airport model, which would then allow me to calculate distances between airport pairs. Now, when I add a new airport, I use AeroAPI to lookup and store the airport’s coordinates in my database.

For the distance calculation itself, I used the haversine formula. This formula isn’t quite perfect since the Earth is not quite a perfect sphere, but since flight distances are already an estimate (planes don’t perfectly follow the great circle line), the haversine worst-case error of 0.5% was more than acceptable for this calculation. Thus, I decided against using Vincenty’s formulae, which are more accurate but also more computationally expensive.

GPX and KML Maps

Flight Historian uses Great Circle Mapper to generate its maps. However, I wanted to have the ability to create a map I could export.

GPX and KML are both XML-based geographic data formats, which I’ve already used for my GPS Logging projects. They both have the ability to specify the coordinates of points and lines on a map, which is all I really need to create flight maps.

Generating the files was a relatively straightforward task. I already had a Map class which would accept airports, routes, and options, and create a querystring I could pass to the Great Circle Mapper. Generating this querystring already involved looping through the provided airports and routes to build a string with a specified format; I could use similar loops to generate an XML document in accordance with the GPX or KML specifications.

Google Earth, showing a trip from CMH-DFW-TUS-SFO-YVR-YYZ-CMH.

KML map files can be opened in Google Earth.

Changelog

New

Changed

Tags: