code: public BufferedImage drawTileQueryIndex(int x, int y, int zoom) {
  
  		// Get the web mercator bounding box
  		BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils
  				.getWebMercatorBoundingBox(x, y, zoom);
  
  		BufferedImage image = null;
  
  		// Query for the geometry count matching the bounds in the index
  		long tileCount = queryIndexedFeaturesCount(webMercatorBoundingBox);
  
  		// Draw if at least one geometry exists
  		if (tileCount > 0) {
  
  			// Query for geometries matching the bounds in the index
  			CloseableIterator<GeometryIndex> results = queryIndexedFeatures(webMercatorBoundingBox);
  
  			try {
  
  				if (maxFeaturesPerTile == null
  						|| tileCount <= maxFeaturesPerTile.longValue()) {
  
  					// Draw the tile image
  					image = drawTile(zoom, webMercatorBoundingBox, results);
  
  				} else if (maxFeaturesTileDraw != null) {
  
  					// Draw the max features tile
  					image = maxFeaturesTileDraw.drawTile(tileWidth, tileHeight,
  							tileCount, results);
  				}
  			} finally {
  				try {
  					results.close();
  				} catch (IOException e) {
  					LOGGER.log(Level.WARNING,
  							"Failed to close result set for query on x: " + x
  									+ ", y: " + y + ", zoom: " + zoom, e);
  				}
  			}
  		}
  
  		return image;
  	}
docs: Draw a tile image from the x, y, and zoom level by querying features in
  the tile location
  
  @param x
  x coordinate
  @param y
  y coordinate
  @param zoom
  zoom level
  @return drawn image, or null