From a BasicRasterLayer you can use the CIMRasterStretchColorizer.StretchStats to get the min/max values, but I want to get the min/max from a custom extent. Since a Raster lets me set a new extent, I've been trying to get some useful values out of it.
Any suggestions or recommendations?
In ArcGIS Pro1.4 there was no way to get statistics about raster except using geoprocessing. This is a part of code I use in my application:
var parameters = Geoprocessing.MakeValueArray(raster, "MINIMUM");
var environments = Geoprocessing.MakeEnvironmentArray(workspace: sWorkspace);
return Geoprocessing.ExecuteToolAsync("GetRasterProperties_management", parameters, environments, CancelableProgressor.None, GPExecuteToolFlags.AddToHistory);
The worst thing that you can get only one type of statistics at time. To get "MAX" you need to call geoprocessing another time with "MAX" parameter.
ArcGIS Pro 2.0 has raster object, but I have not checked if it has statisrtics like IRaster in ArcObjects.
I have wrote that is a part of code You need to organize all async/wait things and etc. "raster" parameter could be RasterLayer or raster path (string). I could. send you more code, but there are snippets on executing geoprocessing from ArcGIS Pro like this https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geoprocessing.