Feature to Raster Conversion Using C# and ArcGIS

Import ArcGIS.ConversionTools and ArcGIS.Geoprocessor then pass the file paths as param into following function you will get the resulting raster out of shapefile.

 using ESRI.ArcGIS.ConversionTools;  
 using ESRI.ArcGIS.Geoprocessor;  
   
 public static void Rasterize(string inputFeature, string outRaster, string fieldName, int cellSize)  
     {      
         //Runtime manager to find the ESRI product installed in the system  
         ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);  
   
         Geoprocessor geoprocessor = new Geoprocessor();  
         geoprocessor.OverwriteOutput = true;  
   
         FeatureToRaster featureToRaster = new FeatureToRaster();  
         featureToRaster.cell_size = cellSize;  
         featureToRaster.in_features = inputFeature;  
         featureToRaster.out_raster = outRaster;  
         featureToRaster.field = fieldName;  
   
         geoprocessor.Execute(featureToRaster, null);  
     }  

Comments

Popular posts from this blog

Prevent WPF Global Keyboard Hook from stops working after hitting keys a while C# .NET

Generate ArcGIS Token By URL Request From ArcGIS Portal, Federated Environment , ESRI JS API and Angular snippets

Solution: IntelliJ not recognizing a particular file correctly, instead its stuck as a text file