@SuppressWarnings("unchecked")
public InternalTile getTile(TileMetadata tileMetadata) throws GeomajasException {
log.debug("getTile start tileMetadata {}", tileMetadata);
long ts = System.currentTimeMillis();
String layerId = tileMetadata.getLayerId();
VectorLayer layer = getVectorLayer(layerId);
PipelineContext context = pipelineService.createContext();
context.put(PipelineCode.LAYER_ID_KEY, layerId);
context.put(PipelineCode.LAYER_KEY, layer);
context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata);
Crs crs = geoService.getCrs2(tileMetadata.getCrs());
context.put(PipelineCode.CRS_KEY, crs);
CrsTransform layerToMap = geoService.getCrsTransform(layer.getCrs(), crs);
context.put(PipelineCode.CRS_TRANSFORM_KEY, layerToMap);
Envelope layerExtent = dtoConverterService.toInternal(layer.getLayerInfo().getMaxExtent());
Envelope tileExtent = geoService.transform(layerExtent, layerToMap);
context.put(PipelineCode.TILE_MAX_EXTENT_KEY, tileExtent);
InternalTile tile = new InternalTileImpl(tileMetadata.getCode(), tileExtent, tileMetadata.getScale());
GetTileContainer response = new GetTileContainer();
response.setTile(tile);