Select to view content in your preferred language

How to Load Multidimensional Raster Layer via C#

03-28-2023 01:01 PM
New Contributor

I have created a raster layer programmatically by loading in a netCDF file into a RasterDataset and then creating a ClassifyColorizerDefinition. I use these to create the raster layer from a LayerFactory after targeting the file URI.

I am noticing that when loading in this raster layer, the data is not handled the same way it is in the Add Data > "Multidimensional Raster Layer" tool. I need to programmatically load in each array from the NetCDF file as it's own layer. Would anyone know how to accomplish this or tell me if I am looking in the wrong direction? I am using the ArcGIS Pro 3.0 SDK for C#




            await QueuedTask.Run(async () =>
                // Create a FileSystemConnectionPath using the folder path.
                FileSystemConnectionPath connectionPath = new FileSystemConnectionPath(new Uri(run), FileSystemDatastoreType.Raster);
                // Create a new FileSystemDatastore using the FileSystemConnectionPath.
                FileSystemDatastore dataStore = new FileSystemDatastore(connectionPath);
                // Open the raster dataset.
                RasterDataset fileRasterDataset = dataStore.OpenDataset<RasterDataset>(scenario + ".nc");

                // Colormap
                ClassifyColorizerDefinition avocado = new ClassifyColorizerDefinition("Pressures", 4, ClassificationMethod.Manual, colorRamp);

                var rasterLayerCreationParams = new RasterLayerCreationParams(fileRasterDataset)
                    ColorizerDefinition = avocado,
                    Name = scenario,
                    MapMemberIndex = 0

                RasterLayer rasterLayerfromURL =
                    LayerFactory.Instance.CreateLayer<RasterLayer>(rasterLayerCreationParams, MapView.Active.Map);
                mapView.AddOverlay(rasterLayerfromURL, 0, SymbolFactory.Instance.ConstructPolygonSymbol(




0 Kudos
0 Replies