kingforger
Active member
I want to convert latitude/longitude to MGRS coordinates. Using this wonderful library called "GeographicLib", I can do that quite easily on the windows platform. Here's my little program utilizing that library:
It compiles, runs, and gives me the MGRS coordinates accurately. Geographic lib can be downloaded from: http://geographiclib.sourceforge.net/
HOWEVER, I'm having serious issues getting this to compile in the arduino IDE that comes with the Teensy 3.0. I was just going through the errors as they came to me during compilation, but it's become apparent to me that I'm going to have to fix a hell of a lot of errors. And some of them are starting to become beyond my ability to fix or even understand (I'm a rather novice C++/C programmer). Anyone have any ideas?
Code:
#include <iostream>
#include <exception>
#include <string>
#include "GeographicLib\UTMUPS.hpp"
#include "GeographicLib\MGRS.hpp"
using namespace std;
using namespace GeographicLib;
int main() {
double lat = 33.3, lon = 44.4; // Baghdad
int zone;
bool northp;
double x, y;
UTMUPS::Forward(lat, lon, zone, northp, x, y);
string mgrs;
MGRS::Forward(zone, northp, x, y, 5, mgrs);
cout << mgrs << "\n";
return 0;
}
It compiles, runs, and gives me the MGRS coordinates accurately. Geographic lib can be downloaded from: http://geographiclib.sourceforge.net/
HOWEVER, I'm having serious issues getting this to compile in the arduino IDE that comes with the Teensy 3.0. I was just going through the errors as they came to me during compilation, but it's become apparent to me that I'm going to have to fix a hell of a lot of errors. And some of them are starting to become beyond my ability to fix or even understand (I'm a rather novice C++/C programmer). Anyone have any ideas?