arcengine GP调用PolygonToLine 报错 -2147467259
这个原因是传参数问题;
GP调用面转线工具时,不能利用该方式传入参数
IGpValueTableObject gpValueTableObject = new GpValueTableObject();//对一个及以上要素类进行相交运算
gpValueTableObject.SetColumns(2);
object o1 = pFeatureClass2;//输入IFeatureClass 1
gpValueTableObject.AddRow(ref o1);
GP_PolyGonToline.in_features = gpValueTableObject;
可能参数问题二(特别注意)
GP_PolyGonToline.out_feature_class = System.IO.Path.Combine(defaultgdb, "cs")+"\\csline";
可能就是gdb在其它地方打开或者被占用,所以也会出现报错
正确调用方式是,如下
Geoprocessor GP_Tool = new Geoprocessor();
GP_Tool.OverwriteOutput = true;
PolygonToLine GP_PolyGonToline = new PolygonToLine();
GP_PolyGonToline.in_features = pFeatureClass;
//GP_PolyGonToline.in_features = @"C:\Users\ZZY\Documents\ArcGIS\Default.gdb\ggg_FeatureToPolygon";
(in_features 可以用Featureclass,也可以用gdb的路径方式,但是不能用@“D:\gis数据\ceshi.shp”这个路径)
GP_PolyGonToline.neighbor_option = "false";
GP_PolyGonToline.out_feature_class = @"C:\Users\ZZY\Documents\ArcGIS\Default.gdb\ggg_2";
GP_Tool.Execute(GP_PolyGonToline, null);