for (ReferencedEnvelope env : keySet) {
Tile tile = tiles.get(env);
//System.out.println("BufferedImage: "+tile.getBufferedImage());
ViewportModel viewportModelInternal = tile.getRenderExecutor().getRenderer().getContext().getViewportModelInternal();
java.awt.Point a = viewportModelInternal.worldToPixel(new Coordinate(env.getMinX(), env.getMinY()));
java.awt.Point b = viewportModelInternal.worldToPixel(new Coordinate(env.getMaxX(), env.getMaxY()));
g.drawImage((RenderedImage)tile.getBufferedImage(), a.x, b.y);
g.setColor(Color.BLUE);
g.drawLine(a.x, a.y, a.x, b.y);
g.drawLine(a.x, b.y, b.x, b.y);
g.drawLine(b.x, b.y, b.x, a.y);