Posts

Showing posts with the label zonal-statistics

Calculate zonal-statistics using ESRI ArcObjects and C#

Import the following references in the project. using ESRI.ArcGIS.Geoprocessor; using ESRI.ArcGIS.SpatialAnalystTools; using ESRI.ArcGIS.esriSystem; This solution is only works for single band raster. For multi-band raster zonal statistics I will make a separate post soon. public static void ComputeZonalStatisticsFromEsri(string feature, string zoneField, string valueRaster, string outputTable) { ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop); ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.Desktop); UID pUid = new UIDClass(); pUid.Value = "esriSpatialAnalystUI.SAExtension"; // Add Spatial Analyst extension to the license manager. object v = null; IExtensionManagerAdmin extensionManagerAdmin = new ExtensionManagerClass(); extensionManagerAdmin.AddExtension(pUid, ref v); // Enable the license. IExtensionManager extensionMana...