在AO中使用Geoprocessor(ESRI.ArcGIS.Geoprocessor)

1。观察arcmap中的使用方法,明确各参数意义。

2。arctoolbox中参数对应为features/feature layer的(即需要在下拉菜单中选择,需要首先加载到arcmap上的),首先使用MakeFeatureLayer:

Geoprocessor 使用
Geoprocessor gp=new Geoprocessor();

MakeFeatureLayer mfl=new MakeFeatureLayer();
mfl.in_features=@"e:\test.shp";
mfl.out_layer="test";    //feature layer name

gp.Execute(mfl,null);
Geoprocessor 使用

然后在调用其他gp的时候就可以直接使用此featureLayer:

RepairGeometry rg=new RepairGeometry();
rg.in_features="test";
gp.Execute(rg,null);

 

3.如gp执行错误时,可打印消息:

int count=gp.MessageCount;
for(int i=0;i<count;i++)
{
  Console.WriteLine(gp.GetMessage(i));  
}

 

相关文章:

  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案