Let's say I want to do a flight from Innsbruck (LOWI) to Strasbourg (LFST). Because the user waypoint limit on the GTN units is 1000, I have to stay bellow this number so I definitely can't insert the whole world in - Austria has about 600 points while France has about 3000. So my idea was to choose from my NavData Waypoint.txt file only those fixes that are within 30 NM from LOWI and LFST. So 30 miles from your departure and destination airports. Don't worry about radio navaids as they are usually older so already in the database.
This way I can create a custom procedure - inserting waypoints and smartly using the vertical navigation to obey the procedure on the chart (you need the charts, of course, as GTNs don't let you make custom procedures. Just remember to import your custom waypoints before the flight - maybe delete the old ones so that you have enough memory on the GTN.
Now the implementation...
For this I used the KLN 90B Navdata installed by NAVDataPro in my X-Plane installation, but I can definitely use anything that looks like this:
CTBRT|44843492|-117811486|K1
CTC01|-33910950|18625992|FA
CTC04|-34049367|18555842|FA
CTC06|-33865422|18849819|FA
CTC07|-33951367|18441983|FA
CTC08|-33955661|18347758|FA
CTC09|-33824014|19209500|FA
CTC11|-33618278|18736942|FA
CTC14|-34023358|18682425|FA
CTC15|-33883558|19065564|FA
so look in your navdata's for the waypoint file and remember the format.
The rest is just C++. I am going to put it in here, you just have to know a little programming and make a project in Visual Studio/Linux. By the end you'll have a little file that contains only those necessary waypoints and you will have to copy-paste the whole thing into your ...\SteamLibrary\steamapps\common\FSX\F1GTN\userwpt.txt file.
Code: Select all
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
int main()
{
std::ifstream input("WPTs.txt", std::ifstream::in);
std::ofstream output("userwpt.txt", std::ofstream::out);
float controlLAT = 47.260;
float controlLON = 11.344;
std::string line = "";
std::string formattedLine = "";
char buff_line[50];
while (input.getline(buff_line, 50)) {
line.assign(buff_line);
size_t name = line.find("|");
size_t lat = line.find("|", name + 1);
size_t lon = line.find("|", lat + 1);
size_t end = line.find("|", lon + 1);
float latitude = 0.0;
float longitude = 0.0;
//if (line.substr(lon + 1, end - lon - 1).compare("LT") != 0)
// continue;
formattedLine = line.substr(0,name);
formattedLine += ",,";
formattedLine += line.substr(name + 1, lat - name - 1);
if ((lat - name) > 6) {
formattedLine.insert(formattedLine.size() - 6, ".");
latitude = atof(line.substr(name + 1, lat - name - 1).c_str()) / 1000000.;
}
else {
formattedLine += ".0";
latitude = atof(line.substr(name + 1, lat - name - 1).c_str());
}
formattedLine += ",";
formattedLine += line.substr(lat + 1, lon - lat - 1);
if ((lon - lat) > 6) {
formattedLine.insert(formattedLine.size() - 6, ".");
longitude = atof(line.substr(lat + 1, lon - lat - 1).c_str()) / 1000000.;
}
else {
formattedLine += ".0";
longitude = atof(line.substr(lat + 1, lon - lat - 1).c_str());
}
if (fabs(controlLAT - latitude) > 0.5 || fabs(controlLON - longitude) > 0.5)
continue;
size_t wrongCheck = 0;
while (formattedLine.find(",.", wrongCheck) != std::string::npos) {
wrongCheck = formattedLine.find(",.", wrongCheck);
formattedLine.insert(wrongCheck + 1, "0");
wrongCheck++;
}
wrongCheck = 0;
while (formattedLine.find(",-.", wrongCheck) != std::string::npos) {
wrongCheck = formattedLine.find(",-.", wrongCheck);
formattedLine.insert(wrongCheck + 2, "0");
wrongCheck++;
}
output << formattedLine << std::endl;
}
input.close();
output.close();
return 0;
}
Code: Select all
if (fabs(controlLAT - latitude) > 0.5 || fabs(controlLON - longitude) > 0.5)
continue;
After all this, for my LOWI-LFST flight, I have a userwpt.txt file that contains only 195 waypoints (most of them already in the GTN database).
Hope this helps,
Adrian