叠置分析

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

三、实现代码

1) 、叠置求交代码

///

/// 矢量图层叠置分析的叠置求交

///

///

///

///

///

///

///

///

///

public IFeatureLayer CreateOverlayAnayiss_Intersect(IFeatureLayer pInputFLayer, IFeatureLayer pOverlayFLayer, string strWorkspaceFactoryProgID,string strPathName, bool useSelectedInput, bool useSelectedOverlay, double dTolerance)

{

if (pInputFLayer == null)

return;

if (pOverlayFLayer == null)

return;

if (dTolerance < 0)

return;

if (string.IsNullOrEmpty(strWorkspaceFactoryProgID) == true) return;

if (string.IsNullOrEmpty(strPathName) == true)

return;

ITable pInputTable = GetFeatureLayerTable(pInputFLayer,false);

if (pInputTable == null)

return;

ITable pOverlayTable = GetFeatureLayerTable(pOverlayFLayer,false); if (pOverlayTable == null)

return;

//创建输出要素类的名称,指定输出位置

IFeatureClassName pFCName = new FeatureClassNameClass(); IWorkspaceName pWSName = new WorkspaceNameClass(); pWSName.WorkspaceFactoryProgID = strWorkspaceFactoryProgID; pWSName.PathName = strPathName;

IDatasetName pDatasetName = (IDatasetName)pFCName; = "Intersect_result";

pDatasetName.WorkspaceName = pWSName;

//执行叠置求交

IBasicGeoprocessor pBGP = new BasicGeoprocessorClass(); IFeatureClass pOutFClass = null;

try

pOutFClass = pBGP.Intersect(pInputTable, useSelectedInput, pOverlayTable, useSelectedOverlay, dTolerance, pFCName);

}

catch (Exception ex)

{

MessageBox.Show("叠置求交失败");

return null;

}

if (pOutFClass == null)

return null;

//返回叠置求交结果

IFeatureLayer pOutputFLayer = new FeatureLayerClass();

pOutputFLayer.FeatureClass = pOutFClass;

string strFCAliasName = pOutFClass.AliasName;

= strFCAliasName;

return pOutputFLayer;

}

2) 、叠置求和代码

///

/// 矢量图层叠置分析的叠置求和,叠置求和的两个图层必须是面图层

///

///

///

///

///

///

///

///

///

Public IFeatureLayer CreateOverlayAnayiss_Union(IFeatureLayer pInputFLayer,IFeatureLayer pOverlayFLayer,string strWorkspaceFactoryProgID,string strPathName, bool useSelectedInput, bool useSelectedOverlay, double dTolerance)

{

if(pInputFLayer==null)

return;

if(pOverlayFLayer==null)

return;

if(string.IsNullOrEmpty(strWorkspaceFactoryProgID)==true)

return;

if (string.IsNullOrEmpty(strPathName) == true)

return;

ITable pInputTable = GetFeatureLayerTable(pInputFLayer,true);

if (pInputTable == null)

return;

ITable pOverlayTable = GetFeatureLayerTable(pOverlayFLayer,true);

相关文档
最新文档