1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 14:53:21 +02:00

Added possibility to compute the UTM zone from lat/lon reference points

This commit is contained in:
Martin Tůma 2017-04-01 16:25:33 +02:00
parent e87fff4bf8
commit 60f107d7cd

22
src/utm.cpp Normal file
View File

@ -0,0 +1,22 @@
#include "utm.h"
UTM::UTM(const Coordinates &c)
{
int zone = int((c.lon() + 180)/6) + 1;
if (c.lat() >= 56.0 && c.lat() < 64.0 && c.lon() >= 3.0 && c.lon() < 12.0)
zone = 32;
if (c.lat() >= 72.0 && c.lat() < 84.0) {
if (c.lon() >= 0.0 && c.lon() < 9.0)
zone = 31;
else if (c.lon() >= 9.0 && c.lon() < 21.0)
zone = 33;
else if (c.lon() >= 21.0 && c.lon() < 33.0)
zone = 35;
else if (c.lon() >= 33.0 && c.lon() < 42.0)
zone = 37;
}
double cm = (zone - 1)*6 - 180 + 3;
_tm = TransverseMercator(cm, 0.9996, 500000, (c.lat() < 0) ? 10000000 : 0);
}