Files
qt6-migration-pipeline/external/GeographicLib/share/doc/GeographicLib-dev/example-Georef.cpp
T
torstenandCopilot 342ffd3e5c Update submodule to latest BUILD_RTI fixes
- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten
- svcTabCommon: Export-Header-Fix via Fallback-Target
- TrainingAreaBase: Stub-Header für BUILD_RTI=OFF
- ddsfts: Include-Pfad und Dependency-Fixes
- BUILD_RTI=OFF Compilation vollständig unterstützt

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
2026-08-21 19:30:20 +02:00

42 lines
1.1 KiB
C++

// Example of using the GeographicLib::GARS class
#include <iostream>
#include <iomanip>
#include <exception>
#include <string>
#include <GeographicLib/Georef.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
{
// Sample forward calculation
double lat = 57.64911, lon = 10.40744; // Jutland
string georef;
for (int prec = -1; prec <= 11; ++prec) {
Georef::Forward(lat, lon, prec, georef);
cout << prec << " " << georef << "\n";
}
}
{
// Sample reverse calculation
string georef = "NKLN2444638946";
double lat, lon;
int prec;
cout << fixed;
Georef::Reverse(georef.substr(0, 2), lat, lon, prec);
cout << prec << " " << lat << " " << lon << "\n";
Georef::Reverse(georef.substr(0, 4), lat, lon, prec);
cout << prec << " " << lat << " " << lon << "\n";
Georef::Reverse(georef, lat, lon, prec);
cout << prec << " " << lat << " " << lon << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}