27 #define _USE_MATH_DEFINES
32 namespace projections {
34 MinLatitude(-85.05112878), MaxLatitude(85.05112878),MinLongitude(-180),
35 MaxLongitude(180), tileSize(256, 256)
43 lat =
bound(lat, MinLatitude, MaxLatitude);
44 lng =
bound(lng, MinLongitude, MaxLongitude);
46 double x = (lng + 180) / 360;
47 double sinLatitude = sin(lat * M_PI / 180);
48 double y = 0.5 - log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * M_PI);
51 qint64 mapSizeX = s.Width();
52 qint64 mapSizeY = s.Height();
54 ret.SetX((qint64) round(
bound(x * mapSizeX + 0.5, 0, mapSizeX - 1)));
55 ret.SetY((qint64) round(
bound(y * mapSizeY + 0.5, 0, mapSizeY - 1)));
72 double mapSizeX = s.Width();
73 double mapSizeY = s.Height();
76 double xx = (
bound(x, 0, mapSizeX - 1) / mapSizeX) - 0.5;
77 double yy = 0.5 - (
bound(y, 0, mapSizeY - 1) / mapSizeY);
79 ret.
SetLat(90 - 360 * atan(exp(-yy * 2 * M_PI)) / M_PI);
95 return (1.0 / 298.257223563);
105 int xy = (1 << zoom);
106 return Size(xy - 1, xy - 1);