ISpatialFilter spatialFilter = new SpatialFilterClass();
spatialFilter.Geometry = Polygon ;//设置用于筛选几何对象
patialFilter.GeometryField = featureLayer.FeatureClass.ShapfieldName; //设置筛选几何字段
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelWithin;//设置空间几何关系
IFeatureLayer featureLayer = this.axMapControl1.Map.get_Layer(8) as IFeatureLayer;
IFeatureCursor featureCursor = null;
featureCursor = featureLayer.FeatureClass.Search(spatialFilter, false);
IFeature feature = null;
feature = featureCursor.NextFeature();
while (feature != null)
{
string strName = feature.get_Value(feature.Fields.FindField("NAME")).ToString();//你要查询名称
IPoint p=feature.Shape as IPoint;
feature = featureCursor.NextFeature();
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);
参考原文