C#进行arcEngine开发 2

arcengine 空间分析:

目前我知道的有:

  1、Geoprocessor 利用ESRI.ARCGIS.AnalysisTools中的相关工具进行clip,interset,identity操作:

  以clip为例如下:

  string ioutPath = mlstr + xzshpstr;

  Geoprocessor g = new Geoprocessor();

  g.OverwriteOutput = true;

  ESRI.ArcGIS.AnalysisTools.Clip clip = new ESRI.ArcGIS.AnalysisTools.Clip();

  clip.in_features = ifeatureClassXZ;

  clip.clip_features = ifeatureClassTB;

  clip.out_feature_class = ioutPath;

  IGeoProcessorResult igresult = new GeoProcessorResultClass();

  igresult = g.Execute(clip, null) as IGeoProcessorResult;

  需要注意:在arcengine中的文件路径,如果不存在会出错,文件被占用也会出错,一般对于已路径操作的文件,使用System中的相关类得到准确的路径字符串再在arcengine中使用。

以上方法是经过测试可以用的。

  2、使用IBasicGeoprocessor

  3、使用ITopologicalOperator

  Arcengine中的Geometry实现了ITopologicalOperator接口,将Geometry QI 到ITOpologicalOperator上,然后执行各种拓扑操作。

   都没有用过。

arcengine中修改要素集的空间参考:

  1、在sde数据库中的要素类要是属于一个要素集,就只能修改要素集的空间参考。(现在想想纯粹是废话,但是就这个问题还是困扰了我好一阵儿)

  2、一个示例:

  IGeoDataset ifeatureclassds = ifeatureclass as IGeoDataset;

  IGeoDatasetSchemaEdit igeoEdit = ifeatureclassds as IGeoDatasetSchemaEdit;

  if (igeoEdit.CanAlterSpatialReference)

  {

    ISpatialReferenceFactory ispReferenceFactory = new SpatialReferenceEnvironmentClass();

    IProjectedCoordinateSystem ipCoorSys = ispReferenceFactory.CreateProjectedCoordinateSystem(2383);//2362xian 80 38度带 2383 xian 114

    igeoEdit.AlterSpatialReference(ipCoorSys);

  }

  对于坐标系的编号可以在一个网站上找到:

  http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/esriSRProjCS3Type_Constants/002m0000003n000000/

esriSRProjCS_WGS1984WebMercatorMajorAuxSphere , 3857 , WGS 1984 Web Mercator Major Auxilliary Sphere