public void apply(ConveyorTile convTile) throws RequestFilterException { TileLayer tl = convTile.getLayer(); // SRS srs = convTile.getSRS(); GridSubset gridSubset = tl.getGridSubset(convTile.getGridSetId()); int z = (int) convTile.getTileIndex()[2]; long[] gridCoverage = gridSubset.getCoverage(z); // Figure out the radius long width = gridCoverage[2] - gridCoverage[0]; long height = gridCoverage[3] - gridCoverage[1]; // Rounding must always err on the side of // caution if you want to use KML hierarchies long maxRad = 0; if (width > height) { maxRad = (width / 4) + 1; } else { maxRad = (height / 4) + 1; } // Figure out how the requested bounds relate long midX = gridCoverage[0] + width / 2; long midY = gridCoverage[1] + height / 2; long xDist = midX - convTile.getTileIndex()[0]; long yDist = midY - convTile.getTileIndex()[1]; long rad = Math.round(Math.sqrt(xDist * xDist + yDist * yDist)); if (rad > maxRad) { throw new BlankTileException(this); } }