returns the ground resolution for based on latitude and zoom level.
423970
def getGroundResolution(self, latitude, level):
        '''
        
        '''
        latitude = self.clipValue(latitude, self.min_lat, self.max_lat);
        mapSize = self.getMapDimensionsByZoomLevel(level)
        return math.cos(
            latitude * math.pi / 180) * 2 * math.pi * self.earth_radius / \
               mapSize
867711
def zoom_crop(scale:float, do_rand:bool=False, p:float=1.0):
    ""
    zoom_fn = rand_zoom if do_rand else zoom
    crop_fn = rand_crop if do_rand else crop_pad
    return [zoom_fn(scale=scale, p=p), crop_fn()]
240261
def _inc_lat(self, latitude, delta):
        """"""
        y = self._convert_latitude(latitude)
        y += delta
        return 360 / pi * atan(
            exp((180 - y * 360 / (2 ** self._zoom) / self._size) * pi / 180)) - 90
921230
function (toZoom) {
		var crs = this.options.crs;
		return crs.scale(toZoom) / crs.scale(this._zoom);
	}
114897
def getCeilingZoom(self, resolution, unit='meters'):
        
        if resolution in self.RESOLUTIONS:
            return self.getZoom(resolution)
        lo, hi = self._getZoomLevelRange(resolution, unit)
        if lo == 0 or lo == hi:
            return lo
        if hi == len(self.RESOLUTIONS):
            return hi - 1
        return lo + 1
536671
def convertLatLngToPixelXY(self, lat, lng, level):
        '''
        
        '''
        mapSize = self.getMapDimensionsByZoomLevel(level)

        lat = self.clipValue(lat, self.min_lat, self.max_lat)
        lng = self.clipValue(lng, self.min_lng, self.max_lng)

        x = (lng + 180) / 360
        sinlat = math.sin(lat * math.pi / 180)
        y = 0.5 - math.log((1 + sinlat) / (1 - sinlat)) / (4 * math.pi)

        pixelX = int(self.clipValue(x * mapSize + 0.5, 0, mapSize - 1))
        pixelY = int(self.clipValue(y * mapSize + 0.5, 0, mapSize - 1))
        return (pixelX, pixelY)
989196
def pixel_to_geo(pixel, level):
        """"""
        pixel_x = pixel[0]
        pixel_y = pixel[1]
        map_size = float(TileSystem.map_size(level))
        x = (TileSystem.clip(pixel_x, (0, map_size - 1)) / map_size) - 0.5
        y = 0.5 - (TileSystem.clip(pixel_y, (0, map_size - 1)) / map_size)
        lat = 90 - 360 * atan(exp(-y * 2 * pi)) / pi
        lon = 360 * x
        return round(lat, 6), round(lon, 6)
386508
def _zoom(scale:uniform=1.0, row_pct:uniform=0.5, col_pct:uniform=0.5):
    ""
    s = 1-1/scale
    col_c = s * (2*col_pct - 1)
    row_c = s * (2*row_pct - 1)
    return _get_zoom_mat(1/scale, 1/scale, col_c, row_c)
905791
function() {
        var inRange = false;

        if (this.alwaysInRange) {
            inRange = true;
        } else {
            if (this.map) {
                var resolution = this.map.getResolution();
                inRange = ( (resolution >= this.minResolution) &&
                            (resolution <= this.maxResolution) );
            }
        }
        return inRange;
    }
852998
function() {

        if (this.resolutions != null) {
            return OpenLayers.Layer.prototype.getResolution.apply(this, arguments);
        } else {
            var resolution = null;
            
            var viewSize = this.map.getSize();
            var extent = this.getExtent();
            
            if ((viewSize != null) && (extent != null)) {
                resolution = Math.max( extent.getWidth()  / viewSize.w,
                                       extent.getHeight() / viewSize.h );
            }
            return resolution;
        }
     }
794024
function(point) {
        var resolution = this.getResolution();
        var x = ((point.x - this.featureDx) / resolution + this.left);
        var y = (this.top - point.y / resolution);

        if (this.inValidRange(x, y)) { 
            return x + "," + y;
        } else {
            return false;
        }
    }
247583
function () {
        var resolution = null;
        if (this.baseLayer != null) {
            resolution = this.baseLayer.getResolution();
        } else if(this.allOverlays === true && this.layers.length > 0) {
            // while adding the 1st layer to the map in allOverlays mode,
            // this.baseLayer is not set yet when we need the resolution
            // for calculateInRange.
            resolution = this.layers[0].getResolution();
        }
        return resolution;
    }
958239
public static double GroundResolutionMapSize(double latitude, final double mapSize) {
		latitude = Clip(latitude, -90, 90);
		return Math.cos(latitude * Math.PI / 180) * 2 * Math.PI * GeoConstants.RADIUS_EARTH_METERS
				/ mapSize;
	}
37756
def _confirm_resolution(self, implemented_res):
        '''  '''

        assert self.ppd in implemented_res, \
            ' Resolution %d ppd not implemented yet\n.\
            Consider using one of the implemented resolutions %s'\
            % (self.ppd, ', '.join([f + ' ppd' for f in map(str, implemented_res)]))

        if self.ppd == 256:
            assert (np.abs(self.latM) < 60) and (np.abs(self.latm) < 60),\
                'This resolution is available in\n \
                in cylindrical geometry only for -60<latitude<60 '
65094
def res(self):
        
        return (abs(float(self.geo['xres'])), abs(float(self.geo['yres'])))
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
1203874
def _get_dst_resolution(self, dst_res=None):
        """"""
        if dst_res is None:
            dst_res = min(self._res_indices.keys())
        return dst_res