AnsweredAssumed Answered

Interpolate surface C#

Question asked by Ivan on Aug 13, 2015
Latest reply on Aug 14, 2015 by Ivan


I'm trying interpolate surface using point shapefile, but ArcMap crashed on interpolation. I checked and able to do it using predefined Arctoolbox scripts, so data is ok.

I use ArcGIS 10.1 SP1, Spatial Extension, MS Visual Studio 2012, .Net Framework 4.


Does anyone can help in it?


public void InterpolateTest()
            IFeatureClass fcClass01 = default(IFeatureClass);
            fcClass01 = GetFeatureClass(); // see below

// Create FeatureClassDescriptor using a value field.
            IFeatureClassDescriptor fcDescr = default(IFeatureClassDescriptor);
            fcDescr = new FeatureClassDescriptor() as IFeatureClassDescriptor;
            fcDescr.Create(fcClass01, null, "gdsA");

// Create Input geodataset
            IGeoDataset gd = fcClass01 as IGeoDataset;

// Create Output geodataset      

            IRaster rasOut = default(IRaster);

            IInterpolationOp2 interpOp = default(IInterpolationOp2);
            interpOp = new RasterInterpolationOp() as IInterpolationOp2;

  //try to interpolate - crash on this line
            rasOut = (IRaster)interpOp.NaturalNeighbor(gd);





public ESRI.ArcGIS.Geodatabase.IFeatureClass GetFeatureClass()

                    ESRI.ArcGIS.Geodatabase.IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory();
                    String string_RasterWorkspace = "C:\\temp\\";
                    String string_ShapefileName = "dis.shp";

                    ESRI.ArcGIS.Geodatabase.IWorkspace workspace = workspaceFactory.OpenFromFile(string_RasterWorkspace, 0);
                    ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)workspace; // Explict Cast
                    ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(string_ShapefileName);

                    FeatureClass fc = featureClass as FeatureClass;
                    return featureClass;