ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / RasterLayerCreationParams Class / RasterLayerCreationParams Constructor / RasterLayerCreationParams Constructor(Uri)
A System.Uri represents the path or url to a dataset or .lyrx or .lpkx file.
Example

RasterLayerCreationParams Constructor(Uri)
Creates a parameter object with System.Uri.
Syntax
public RasterLayerCreationParams( 
   Uri uri
)

Parameters

uri
A System.Uri represents the path or url to a dataset or .lyrx or .lpkx file.
Example
Create a raster layer with a new colorizer definition
// Create a new stretch colorizer definition using default constructor.
StretchColorizerDefinition stretchColorizerDef = new StretchColorizerDefinition();
var rasterLayerCreationParams = new RasterLayerCreationParams(new Uri(url))
{
  ColorizerDefinition = stretchColorizerDef,
  Name = layerName,
  MapMemberIndex = 0
};
await QueuedTask.Run(() =>
{
  // Create a raster layer using the colorizer definition created above.
  // Note: You can create a raster layer from a url, project item, or data connection.
  RasterLayer rasterLayerfromURL =
    LayerFactory.Instance.CreateLayer<RasterLayer>(rasterLayerCreationParams, aMap);
});
Create a mosaic layer with a new colorizer definition
// Create a new colorizer definition using default constructor.
StretchColorizerDefinition stretchColorizerDef = new StretchColorizerDefinition();
var rasterLayerCreationParams = new RasterLayerCreationParams(new Uri(url))
{
  Name = layerName,
  ColorizerDefinition = stretchColorizerDef,
  MapMemberIndex = 0

};
await QueuedTask.Run(() =>
{
  // Create a mosaic layer using the colorizer definition created above.
  // Note: You can create a mosaic layer from a url, project item, or data connection.
  MosaicLayer newMosaicLayer =
    LayerFactory.Instance.CreateLayer<MosaicLayer>(rasterLayerCreationParams, aMap);
});
Create an image service layer with a new colorizer definition
// Create a new colorizer definition using default constructor.
StretchColorizerDefinition stretchColorizerDef = new StretchColorizerDefinition();
var rasterLayerCreationParams = new RasterLayerCreationParams(new Uri(url))
{
  Name = layerName,
  ColorizerDefinition = stretchColorizerDef,
  MapMemberIndex = 0
};
await QueuedTask.Run(() =>
{
  // Create an image service layer using the colorizer definition created above.
  ImageServiceLayer imageServiceLayer =
    LayerFactory.Instance.CreateLayer<ImageServiceLayer>(rasterLayerCreationParams, aMap);
});
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

ArcGIS Pro version: 3.0 or higher.
See Also