// }
// Sigh....
if (!packageData) {
String overlayXml = createOverlay(tile, false);
tile.setBlob(new ByteArrayResource(overlayXml.getBytes()));
tile.setStatus(200);
// tileLayer.putTile(tile);
} else {
// Get the overlay
String overlayXml = createOverlay(tile, true);
// Get the data (cheat)
try {
tile.setWrapperMimeType(null);
try {
tileLayer.getTile(tile);
} catch (OutsideCoverageException oce) {
log.error("Out of bounds: " + Arrays.toString(tile.getTileIndex())
+ " should never habe been linked to.");
throw oce;
}
tile.setWrapperMimeType(XMLMime.kmz);
} catch (IOException ioe) {
log.error(ioe.getMessage());
ioe.printStackTrace();
throw new ServiceException(ioe.getMessage());
}
byte[] zip = KMZHelper.createZippedKML(gridLocString(tile.getTileIndex()), tile
.getMimeType().getFileExtension(), overlayXml.getBytes(), tile.getBlob());
tile.setBlob(new ByteArrayResource(zip));
tile.setStatus(200);
// tileLayer.putTile(tile);
}