首页 > 代码库 > 根据要素选择集,创建新图层
根据要素选择集,创建新图层
转自原文 根据要素选择集,创建新图层
IFeatureLayer featureLayer = new FeatureLayerClass();
featureLayer.FeatureClass = featureClass;
IFeatureSelection featureSelection = featureLayer as IFeatureSelection;
IQueryFilter queryFilter1 = new QueryFilterClass();
queryFilter1.WhereClause = "XZQDM like ‘" + xz_xzqdm + "%‘";
featureSelection.SelectFeatures(queryFilter1, esriSelectionResultEnum.esriSelectionResultNew, false);
ISelectionSet selectionSet = featureSelection.SelectionSet;
IFeatureLayer newFeatureLayer = null;
if (selectionSet.Count > 0)
{
IFeatureLayerDefinition featureLayerDefinition = featureLayer as IFeatureLayerDefinition;
newFeatureLayer = featureLayerDefinition.CreateSelectionLayer(featureClass.AliasName, true, null, null);
}
根据要素选择集,创建新图层