Exemple #1
0
        private IGeoProcessorResult EraseOverlay(Geoprocessor gp)
        {
            //Erase_analysis (in_features, erase_features, out_feature_class, cluster_tolerance)
            ESRI.ArcGIS.AnalysisTools.Erase erase = new ESRI.ArcGIS.AnalysisTools.Erase();
            IFeatureLayer inputLayer = GetFeatureLayer(strInputLayer);

            erase.in_features = inputLayer;
            IFeatureLayer eraseLayer = GetFeatureLayer(strOverLayer);

            erase.erase_features = eraseLayer;
            string outputFullPath = System.IO.Path.Combine(strOutputPath, strInputLayer + "_" + strOverLayer + "_" + "Erase.shp");

            erase.out_feature_class = outputFullPath;
            erase.cluster_tolerance = tolerance;

            IGeoProcessorResult results = (IGeoProcessorResult)gp.Execute(erase, null);

            //IGpValueTableObject vtobject = new GpValueTableObjectClass();
            //vtobject.SetColumns(1);
            //object row = "";
            //row = GetFeatureLayer(strInputLayer);
            //vtobject.AddRow(ref row);
            //row = GetFeatureLayer(strOverLayer);
            //vtobject.AddRow(ref row);
            //IVariantArray pVarArray = new VarArrayClass();
            //pVarArray.Add(vtobject);

            //string outputFullPath = System.IO.Path.Combine(strOutputPath, strInputLayer + "_" + strOverLayer + "_" + "Erase.shp");
            //pVarArray.Add(outputFullPath);
            //pVarArray.Add(tolerance);

            //IGeoProcessorResult results = gp.Execute("Erase_analysis", pVarArray, null) as IGeoProcessorResult;

            return(results);
        }
Exemple #2
0
        private IGeoProcessorResult EraseOverlay2(Geoprocessor gp)
        {
            //Erase_analysis (in_features, erase_features, out_feature_class, cluster_tolerance)
            ESRI.ArcGIS.AnalysisTools.Erase erase = new ESRI.ArcGIS.AnalysisTools.Erase();
            erase.in_features    = strInputLayer;
            erase.erase_features = strOverLayer;
            string outputFullPath = System.IO.Path.Combine(strOutputPath, strInputLayer + "_" + strOverLayer + "_" + "Erase");

            erase.out_feature_class = outputFullPath;
            erase.cluster_tolerance = tolerance;
            IGeoProcessorResult results = (IGeoProcessorResult)gp.Execute(erase, null);

            return(results);
        }