27 #define _USE_MATH_DEFINES
31 namespace projections {
33 MaxLongitude(180), RAD_DEG(180 / M_PI),DEG_RAD(M_PI / 180),MathPiDiv4(M_PI / 4),tileSize(256, 256)
38 lat =
bound(lat, MinLatitude, MaxLatitude);
39 lng =
bound(lng, MinLongitude, MaxLongitude);
41 double rLon = lng * DEG_RAD;
42 double rLat = lat * DEG_RAD;
45 double k = 0.0818191908426;
47 double z = tan(MathPiDiv4 + rLat / 2) / pow((tan(MathPiDiv4 + asin(k * sin(rLat)) / 2)), k);
48 double z1 = pow(2, 23 - zoom);
50 double DX = ((20037508.342789 + a * rLon) * 53.5865938 / z1);
51 double DY = ((20037508.342789 - a * log(z)) * 53.5865938 / z1);
54 ret.SetX((qint64) round(DX));
55 ret.SetY((qint64) round(DY));
63 double c1 = 0.00335655146887969;
64 double c2 = 0.00000657187271079536;
65 double c3 = 0.00000001764564338702;
66 double c4 = 0.00000000005328478445;
67 double z1 = (23 - zoom);
68 double mercX = (x * pow(2, z1)) / 53.5865938 - 20037508.342789;
69 double mercY = 20037508.342789 - (y *pow(2, z1)) / 53.5865938;
71 double g = M_PI /2 - 2 *atan(1 / exp(mercY /a));
72 double z = g + c1 * sin(2 * g) + c2 * sin(4 * g) + c3 * sin(6 * g) + c4 * sin(8 * g);
76 ret.
SetLng (mercX / a * RAD_DEG);
90 return (1.0 / 298.257223563);
95 return Size(xy - 1, xy - 1);