// write the images
for (int i = 0; i < mapContext.getLayerCount(); i++) {
MapLayer mapLayer = mapContext.getLayer(i);
// create a context for this single layer
WMSMapContext mapContext = new WMSMapContext();
mapContext.addLayer(mapLayer);
mapContext.setRequest(this.mapContext.getRequest());
mapContext.setMapHeight(this.mapContext.getMapHeight());
mapContext.setMapWidth(this.mapContext.getMapWidth());
mapContext.setAreaOfInterest(this.mapContext.getAreaOfInterest());
mapContext.setBgColor(this.mapContext.getBgColor());
mapContext.setBuffer(this.mapContext.getBuffer());
mapContext.setContactInformation(this.mapContext
.getContactInformation());
mapContext.setKeywords(this.mapContext.getKeywords());
mapContext.setAbstract(this.mapContext.getAbstract());
mapContext.setTransparent(true);
// render the map
mapProducer.setMapContext(mapContext);
mapProducer.produceMap();