天天看點

C#+AE 疊加分析

public IFeatureClass Intsect(IFeatureClass _pFtClass,IFeatureClass _pFtOverlay,string _FilePath,string _pFileName)

{

IFeatureClassName pOutPut = new FeatureClassNameClass();

pOutPut.ShapeType = _pFtClass.ShapeType;

pOutPut.ShapeFieldName = _pFtClass.ShapeFieldName;

pOutPut.FeatureType = esriFeatureType.esriFTSimple;

//set output location and feature class name

IWorkspaceName pWsN = new WorkspaceNameClass();

pWsN.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory";

pWsN.PathName = _FilePath;

//也可以用這種方法,IName 和IDataset的用法

IDatasetName pDatasetName = pOutPut as IDatasetName;

pDatasetName.Name = _pFileName;

pDatasetName.WorkspaceName =pWsN;

IBasicGeoprocessor pBasicGeo = new BasicGeoprocessorClass();

IFeatureClass pFeatureClass = pBasicGeo.Intersect(_pFtClass as ITable , false, _pFtOverlay as ITable , false, 0.1, pOutPut);

return pFeatureClass;

}

c#