I want to know whether there is a function provided by ArcObjects (vb.net) to realize the "Select Features by Polygon" on ArcMap (shown below).
I am using VS 2012 (vb.net) and ArcObjects 10.2.2.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
If you want to select features by polygon using ArcObjects, you would typically use a spatial filter, which is very simple to implement. Here's an example in VB.NET, where pPolygon is your polygon object, and pLayer is the layer you wish to select features from:
' create the spatial filter Dim pSpatialFilter As ISpatialFilter = New SpatialFilterClass() pSpatialFilter.Geometry = pPolygon pSpatialFilter.GeometryField = pLayer.FeatureClass.ShapeFieldName pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains ' select features Dim pFeatureSelection As IFeatureSelection pFeatureSelection = pLayer pFeatureSelection.SelectFeatures(pSpatialFilter, esriSelectionResultEnum.esriSelectionResultAdd, False)
If you want to draw the polygon yourself using ArcObjects, then that's a bit of extra work. There are sample functions available to draw a polygon with mouse clicks (just google it), and then use that polygon object as your spatial filter input.