C#+Arcengine调用GP进行裁剪

        上一篇博客说了下怎么调用IBG接口进行矢量数据的裁剪,这次说一个更简单的方法:调用GP进行裁剪。下边直接上代码了:

                Geoprocessor gp = new Geoprocessor();
            gp.OverwriteOutput = true;
            ESRI.ArcGIS.AnalysisTools.Clip clip = new ESRI.ArcGIS.AnalysisTools.Clip();
            clip.clip_features = @” “;//被裁剪图像的路径
            clip.in_features = @””;//裁剪图像的路径
            clip.out_feature_class = @””;输出路径
            gp.Execute(clip, null);
            IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory();
            IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(@””, 0);//输入工作空间路径
            IFeatureClass pFeatureClass = pFeatureWorkspace.OpenFeatureClass(@””);//输出的文件的名字
            IFeatureLayer pFeatureLayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;
            axMapControl1.Map.AddLayer(pFeatureLayer);

        但是我有一事不明,为什么调用GP工具会让程序变得这么慢呢?有没有哪个大手能留言告诉我下,感激不尽

    (PS:Union功能的程序实现和Clip功能的程序实现十分相似,看一下帮助文档,改一下文件的路径就能实现了)

  

转载自:https://blog.csdn.net/u014627099/article/details/52212380

You may also like...