public void execute(MapContext mapContext, ILayer layer) { try { final String geoRasterResult = evaluateResult(layer, mapContext); if (null != geoRasterResult) { // save the computed GeoRaster in a tempFile final DataSourceFactory dsf = ((DataManager) Services.getService(DataManager.class)).getDSF(); DataSource dsResult = dsf.getDataSourceFromSQL(geoRasterResult); // populate the GeoView TOC with a new RasterLayer DataManager dataManager = (DataManager) Services.getService(DataManager.class); final ILayer newLayer = dataManager.createLayer(dsResult); mapContext.getLayerModel().insertLayer(newLayer, 0); } } catch (IOException e) { Services.getErrorManager().error("Cannot compute " + layer.getName(), e); } catch (LayerException e) { Services.getErrorManager() .error("Cannot insert resulting layer based on " + layer.getName(), e); } catch (DriverException e) { Services.getErrorManager().error("Cannot read the raster from the layer ", e); } catch (DriverLoadException e) { Services.getErrorManager().error("Cannot create the resulting layer of raster type ", e); } catch (OperationException e) { Services.getErrorManager().error("Error during the raster operation", e); } catch (DataSourceCreationException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } catch (SemanticException e) { e.printStackTrace(); } }