Lower right tile for an area.

@param boundingBox the area boundingBox
@param zoomLevel   the zoom level.
@param tileSize    the tile size.
@return the tile at the lower right of the bbox.
193381
public static Tile getLowerRight(BoundingBox boundingBox, byte zoomLevel, int tileSize) {
        int tileRight = MercatorProjection.longitudeToTileX(boundingBox.maxLongitude, zoomLevel);
        int tileBottom = MercatorProjection.latitudeToTileY(boundingBox.minLatitude, zoomLevel);
        return new Tile(tileRight, tileBottom, zoomLevel, tileSize);
    }
951267
public Coordinate metersToTile(Coordinate coord, int zoomLevel) {
        Coordinate pixels = metersToPixels(coord.x, coord.y, zoomLevel);
        int tx = (int) pixels.x / 256;
        int ty = (int) pixels.y / 256;
        return new Coordinate(tx, ty, zoomLevel);
    }
911190
public boolean hasTile(BoundingBox requestBoundingBox) {

		boolean hasTile = false;

		// Transform to the projection of the tiles
		ProjectionTransform transformRequestToTiles = requestProjection
				.getTransformation(tilesProjection);
		BoundingBox tilesBoundingBox = requestBoundingBox
				.transform(transformRequestToTiles);

		List<TileMatrix> tileMatrices = getTileMatrices(tilesBoundingBox);

		for (int i = 0; !hasTile && i < tileMatrices.size(); i++) {

			TileMatrix tileMatrix = tileMatrices.get(i);

			TileResultSet tileResults = retrieveTileResults(tilesBoundingBox,
					tileMatrix);
			if (tileResults != null) {

				try {
					hasTile = tileResults.getCount() > 0;
				} finally {
					tileResults.close();
				}
			}
		}

		return hasTile;
	}
1158243
def tile_at(self, zoom, position):
        
        x, y = self.project_pixels(position, zoom)
        return (zoom, int(x/self.tilesize), int(y/self.tilesize))
477969
public List<TileCoordinate> translateToZoomLevel(byte zoomlevelNew) {
        List<TileCoordinate> tiles = null;
        int zoomlevelDistance = zoomlevelNew - this.zoomlevel;

        int factor = (int) Math.pow(2, Math.abs(zoomlevelDistance));
        if (zoomlevelDistance > 0) {
            tiles = new ArrayList<>((int) Math.pow(4, Math.abs(zoomlevelDistance)));
            int tileUpperLeftX = this.x * factor;
            int tileUpperLeftY = this.y * factor;
            for (int i = 0; i < factor; i++) {
                for (int j = 0; j < factor; j++) {
                    tiles.add(new TileCoordinate(tileUpperLeftX + j, tileUpperLeftY + i, zoomlevelNew));
                }
            }
        } else {
            tiles = new ArrayList<>(1);
            tiles.add(new TileCoordinate(this.x / factor, this.y / factor, zoomlevelNew));
        }
        return tiles;
    }
918113
public TileResultSet queryForTilesInRow(long row, long zoomLevel) {

		Map<String, Object> fieldValues = new HashMap<String, Object>();
		fieldValues.put(TileTable.COLUMN_TILE_ROW, row);
		fieldValues.put(TileTable.COLUMN_ZOOM_LEVEL, zoomLevel);

		return queryForFieldValues(fieldValues);
	}
367921
public static BoundingBox getBoundingBox(int x, int y, int zoom) {

		int tilesPerSide = tilesPerSide(zoom);
		double tileWidthDegrees = tileWidthDegrees(tilesPerSide);
		double tileHeightDegrees = tileHeightDegrees(tilesPerSide);

		double minLon = -180.0 + (x * tileWidthDegrees);
		double maxLon = minLon + tileWidthDegrees;

		double maxLat = 90.0 - (y * tileHeightDegrees);
		double minLat = maxLat - tileHeightDegrees;

		BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat);

		return box;
	}
600166
public static int pixelXToTileX(double pixelX, byte zoomLevel, int tileSize) {
        return (int) Math.min(Math.max(pixelX / tileSize, 0), Math.pow(2, zoomLevel) - 1);
    }
267689
public static List<Long> getTilesCoverage(final BoundingBox pBB,
                                              final int pZoomMin, final int pZoomMax) {
        final List<Long> result = new ArrayList<>();
        for (int zoomLevel = pZoomMin; zoomLevel <= pZoomMax; zoomLevel++) {
            final Collection<Long> resultForZoom = getTilesCoverage(pBB, zoomLevel);
            result.addAll(resultForZoom);
        }
        return result;
    }
717967
public static double getPixelXSize(BoundingBox webMercatorBoundingBox,
			long matrixWidth, int tileWidth) {
		double pixelXSize = (webMercatorBoundingBox.getMaxLongitude() - webMercatorBoundingBox
				.getMinLongitude()) / matrixWidth / tileWidth;
		return pixelXSize;
	}
379013
def tile_width(self, zoom):
        
        warnings.warn(DeprecationWarning("tile_width is deprecated"))
        validate_zoom(zoom)
        matrix_pixel = 2**(zoom) * self.tile_size * self.grid.shape.width
        tile_pixel = self.tile_size * self.metatiling
        return matrix_pixel if tile_pixel > matrix_pixel else tile_pixel
436827
public boolean isWithinBoundingBox(int x, int y, int zoom) {
        boolean withinBounds = true;

        // If a bounding box is set, check if it overlaps with the request
        if (webMercatorBoundingBox != null) {

            // Get the bounding box of the requested tile
            BoundingBox tileWebMercatorBoundingBox = TileBoundingBoxUtils
                    .getWebMercatorBoundingBox(x, y, zoom);

            // Adjust the bounding box if needed
            BoundingBox adjustedWebMercatorBoundingBox = getWebMercatorBoundingBox(tileWebMercatorBoundingBox);

            // Check if the request overlaps
            withinBounds = adjustedWebMercatorBoundingBox.intersects(
                    tileWebMercatorBoundingBox, true);
        }

        return withinBounds;
    }
1361738
public Coordinate tileTopLeft(int tx, int ty, int zoomLevel) {
        int px = tx * tileSize;
        int py = ty * tileSize;
        Coordinate result = pixelsToMeters(px, py, zoomLevel);
        return result;
    }
311798
def to_tile(self, zoom):
        
        p1 = self.min.to_tile(zoom)
        p2 = self.max.to_tile(zoom)
        return GridBB(zoom, p1.x, p2.y, p2.x, p1.y)
1214483
function (bounds) {
        bounds = this.adjustBounds(bounds);
        var mapRes = this.map.getResolution();
        var scale = Math.round((this.map.getScale() * 10000)) / 10000;
        var pX = Math.round(bounds.left / mapRes);
        var pY = -Math.round(bounds.top / mapRes);

        var metaX = Math.floor(pX / this.tileSize.w / this.params.metaTileSize.w) * this.tileSize.w * this.params.metaTileSize.w;
        var metaY = Math.floor(pY / this.tileSize.h / this.params.metaTileSize.h) * this.tileSize.h * this.params.metaTileSize.h;
    
        var components = [
            "/",
            this.params.map,
            "/",
            scale,
            "/",
            this.params.g.replace(/\s/g, '_'),
            "/def/t", 
            metaY,
            "/l",
            metaX,
            "/t",
            pY,
            "l",
            pX,
            ".",
            this.extension
          ];

        var url = this.url;

        if (OpenLayers.Util.isArray(url)) {
            url = this.selectUrl(components.join(''), url);
        }
        return url + components.join("");
    }
1119283
public static Collection<Long> getTilesCoverage(final BoundingBox pBB, final int pZoomLevel){
        final Set<Long> result = new LinkedHashSet<>();
        for (Long mapTile : getTilesCoverageIterable(pBB, pZoomLevel, pZoomLevel)) {
            result.add(mapTile);
        }
        return result;
    }
1294784
@Override
    public Tile getTile(int x, int y, int zoom)
    {
        return new Tile(x, y, zoom)
        {
            @Override
            public synchronized boolean isLoaded()
            {
                return true;
            }

            @Override
            public BufferedImage getImage()
            {
                return emptyTile;
            }

        };
    }