tileYToLatitude method

  1. @override
double tileYToLatitude(
  1. int tileY
)
override

Converts a tile Y coordinate to the corresponding latitude (northern edge).

Returns the latitude of the northern (top) edge of the specified tile. Uses inverse Mercator projection formulas.

tileY The tile Y coordinate to convert Returns the latitude in degrees of the tile's northern boundary

Implementation

@override
double tileYToLatitude(int tileY) {
  assert(tileY >= 0);
  // allow one more so that we can find the end of the tile from the top
  assert(tileY <= _maxTileCount, "$tileY > $_maxTileCount of zoomlevel ${scalefactor.zoomlevel}");
  const double pi2 = 2 * pi;
  const double pi360 = 360 / pi;
  double y = 0.5 - (tileY / _scalefactor.scalefactor);
  return 90 - pi360 * atan(exp(-y * pi2));
}