if (featuresPerTile == null || featuresPerTile.intValue() <= 1)
featuresPerTile = 64;
// sanity check, the layer is not geometryless
if (featureType.getFeatureType().getGeometryDescriptor() == null)
throw new WmsException(featureType.getName()
+ " is geometryless, cannot generate KML!");
// make sure the request is within the data bounds, allowing for a
// small error
ReferencedEnvelope requestedEnvelope = context.getAreaOfInterest()
.transform(WGS84, true);
LOGGER.log(Level.FINE, "Requested tile: {0}", requestedEnvelope);
dataEnvelope = featureType.getLatLonBoundingBox();
// decide which tile we need to load/compute, and make sure
// it's a valid tile request, that is, that is does fit with
// the general tiling scheme (minus an eventual small error)
Tile tile = new Tile(requestedEnvelope);
ReferencedEnvelope tileEnvelope = tile.getEnvelope();
if (!envelopeMatch(tileEnvelope, requestedEnvelope))
throw new WmsException(
"Invalid bounding box request, it does not fit "
+ "the nearest regionating tile. Requested area: "
+ requestedEnvelope + ", " + "nearest tile: "
+ tileEnvelope);
// oki doki, let's compute the fids in the requested tile
featuresInTile = getFeaturesForTile(dataDir, tile);
LOGGER.log(Level.FINE, "Found "+featuresInTile.size() + " features in tile " + tile.toString());
} catch (Throwable t) {
LOGGER.log(Level.SEVERE,
"Error occurred while pre-processing regionated features",
t);
throw new WmsException("Failure while pre-processing regionated features");
}
// This okay, just means the tile is empty
if (featuresInTile.size() == 0) {
throw new HttpErrorCodeException(204);