Convert a latitude to it's pixel value given a `zoom` level.

@param {number} latitude
@param {number} zoom
@return {number} pixel
@example
var yPixel = lonlat.latitudeToPixel(40, 9) //= 49621.12736343896
761019
function latitudeToPixel (latitude, zoom) {
  const latRad = toRadians(latitude)
  return (1 -
    Math.log(Math.tan(latRad) + (1 / Math.cos(latRad))) /
      Math.PI) / 2 * zScale(zoom)
}
548296
def tileAddress(self, zoom, point):
        ""
        [x, y] = point
        assert x <= self.MAXX and x >= self.MINX
        assert y <= self.MAXY and y >= self.MINY
        assert zoom in range(0, len(self.RESOLUTIONS))

        tileS = self.tileSize(zoom)
        offsetX = abs(x - self.MINX)
        if self.originCorner == 'bottom-left':
            offsetY = abs(y - self.MINY)
        elif self.originCorner == 'top-left':
            offsetY = abs(self.MAXY - y)
        col = offsetX / tileS
        row = offsetY / tileS
        # We are exactly on the edge of a tile and the extent
        if x in (self.MINX, self.MAXX) and col.is_integer():
            col = max(0, col - 1)
        if y in (self.MINY, self.MAXY) and row.is_integer():
            row = max(0, row - 1)
        return [
            int(math.floor(col)),
            int(math.floor(row))
        ]
194264
function(zoom) {
        zoom = Math.max(0, Math.min(zoom, this.resolutions.length - 1));
        var resolution;
        if(this.map.fractionalZoom) {
            var low = Math.floor(zoom);
            var high = Math.ceil(zoom);
            resolution = this.resolutions[low] -
                ((zoom-low) * (this.resolutions[low]-this.resolutions[high]));
        } else {
            resolution = this.resolutions[Math.round(zoom)];
        }
        return resolution;
    }
303880
function zoomTo(geom) {
                // when the view is ready
                return self.view.when(function() {
                    // zoom to the buffer geometry
                    return self.view.goTo({
                        target: geom,
                        scale: 24000,
                        tilt: 0,
                        heading: 0
                    }).then(function() {
                        // resolve the promises with the input geometry
                        return geom;
                    });
                });
            }
1161056
public static function latToPixels($lat, $zoom)
    {
        if ($lat == 90) {
            $pixelY = 0;
        } elseif ($lat == -90) {
            $pixelY = 256;
        } else {
            $latRad = deg2rad($lat);
            $mercY = log(tan(pi() / 4 + $latRad / 2));
            $cartY = pi() - $mercY;
            $pixelY = $cartY * 256 / 2 / pi();
            $pixelY = max(0, $pixelY); // correct rounding errors near north and south poles
            $pixelY = min(256, $pixelY); // correct rounding errors near north and south poles
        }
        $pixelYZoom = $pixelY * pow(2, $zoom);

        return $pixelYZoom;
    }
351810
private static double latitudeToY(double latitude) {
        double sinLatitude = Math.sin(latitude * (Math.PI / 180));
        return 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
    }
1253042
def _deg2num(self, lat_deg, lon_deg, zoom, leave_float=False):
        
        lat_rad = mod_math.radians(lat_deg)
        n = 2.0 ** zoom
        xtile = (lon_deg + 180.0) / 360.0 * n
        ytile = (1.0 - mod_math.log(mod_math.tan(lat_rad) + (1 / mod_math.cos(lat_rad))) / mod_math.pi) / 2.0 * n
        if not leave_float:
            xtile = int(xtile)
            ytile = int(ytile)
        return TileInfo(xtile, ytile, zoom)
974353
def getScale(self, zoom):
        """"""
        if self.unit == 'degrees':
            resolution = self.getResolution(zoom) * EPSG4326_METERS_PER_UNIT
        else:
            resolution = self.getResolution(zoom)
        return resolution / STANDARD_PIXEL_SIZE
635519
function (latlon) {
        return {
            x: latlon.lng * 6378137 * Math.PI / 180,
            y: Math.log(Math.tan((90 + latlon.lat) * Math.PI / 360)) * 6378137
        };
    }
303326
public void setZoom(int zoom)
    {
        zoomChanging = true;
        mainMap.setZoom(zoom);
        miniMap.setZoom(mainMap.getZoom() + 4);
        if (sliderReversed)
        {
            zoomSlider.setValue(zoomSlider.getMaximum() - zoom);
        }
        else
        {
            zoomSlider.setValue(zoom);
        }
        zoomChanging = false;
    }
192529
function () {
        var zoom = this.map.getZoom();
        var extent = this.map.getMaxExtent();
        zoom = zoom - Math.log(this.maxResolution / (this.lzd/512))/Math.log(2);
        return zoom;
    }
693763
function (e) {
        var scale = this._map.getZoomScale(e.zoom),
            offset = this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(), e.zoom, e.center);

        L.DomUtil.setTransform(this._glMap._actualCanvas, offset.subtract(this._offset), scale);
        }
1201869
function(distance, latitude) {
  var radians = degreesToRadians(latitude);
  var num = Math.cos(radians)*g_EARTH_EQ_RADIUS*Math.PI/180;
  var denom = 1/Math.sqrt(1-g_E2*Math.sin(radians)*Math.sin(radians));
  var deltaDeg = num*denom;
  if (deltaDeg  < g_EPSILON) {
    return distance > 0 ? 360 : 0;
  }
  else {
    return Math.min(360, distance/deltaDeg);
  }
}
959316
def lonlat_to_screen(self, lon, lat):
        
        if type(lon) == list:
            lon = np.array(lon)
        if type(lat) == list:
            lat = np.array(lat)

        lat_rad = np.radians(lat)
        n = 2.0 ** self.zoom
        xtile = (lon + 180.0) / 360.0 * n
        ytile = (1.0 - np.log(np.tan(lat_rad) + (1 / np.cos(lat_rad))) / math.pi) / 2.0 * n
        x = (xtile * TILE_SIZE).astype(int)
        y = (SCREEN_H - ytile * TILE_SIZE).astype(int)
        return x, y
14167
def _convert_latitude(self, latitude):
        """"""
        return int((180 - (180 / pi * log(tan(
            pi / 4 + latitude * pi / 360)))) * (2 ** self._zoom) * self._size / 360)
606507
function (point) {
    var latlng = this.getNativeMap().containerPointToLatLng([point.x, point.y]);
    return {
      lat: latlng.lat,
      lng: latlng.lng
    };
  }
921277
function(min, max) {
    return function limitVisibleY(params) {

      // Do nothing for a null viewport.
      if (params.width <= 0 || params.height <= 0) {
        return params;
      }

      // Calculate the X to Y conversion factor.
      var viewportAspectRatio = params.width / params.height;
      var factor = viewportAspectRatio / params.mediaAspectRatio;

      // Calculate the zoom value that makes the specified range fully visible.
      var maxZoom = (max - min) * factor;

      // Clamp zoom to the maximum value.
      if (params.zoom > maxZoom) {
        params.zoom = maxZoom;
      }

      // Bound Y such that the image is visible up to the range edges.
      var minY = min + 0.5 * params.zoom / factor;
      var maxY = max - 0.5 * params.zoom / factor;
      params.y = clamp(params.y, minY, maxY);

      return params;
    };
  }