DynamicLayerInfoCollection layerInfos = localDynamicLayer.getDynamicLayerInfos(); DynamicLayerInfo layerInfo = layerInfos.get(0); /* Apply a renderer for vector layers. * Note: It is always necessary to provide a renderer, but the renderer provided does * not need to be valid with regard to the actual layer and geometry type, it simply * needs to be a valid renderer. If the renderer specified here is not appropriate for * the geometry type of the layer the symbology will fall back to a default * SimpleMarkerSymbol, SimpleLineSymbol or SimpleFillSymbol. */ DrawingInfo drawingInfo = new DrawingInfo(simpleRenderer, TRANSPARENCY); layerInfo.setDrawingInfo(drawingInfo); // Create the raster data source RasterDataSource dataSource = new RasterDataSource(); dataSource.setWorkspaceId(workspaceId); dataSource.setDataSourceName(fileName); // Set the data source LayerDataSource layerDataSource = new LayerDataSource(); layerDataSource.setDataSource(dataSource); layerInfo.setLayerSource(layerDataSource);
Solved! Go to Solution.