How do I select point feature on mouse click?

I can select polygon feature but I cannot select apoint feature.

ESRI.ArcGIS.Carto.IIdentify identifyLayer = (IIdentify)iLayer;
IArray array = identifyLayer.Identify(identifyPoint);

2 Answers 2


The first step is to convert your clicked point into map coordinates, on your event the X and Y are screen coordinates which need to be converted with IDisplayTransformation:

In your OnMouseDown event:

IPoint pQueryPoint = new PointClass();
pQueryPoint = gDoc.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);

gDoc is of type IMxDocument. Then buffer the query point to a query geometry, this example is in pixels to map coordinates:

int PxTol = 6; // 6 pixels to select by
IPoint pNextPoint = gDoc.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X + PxTol, arg.Y);
double pSrchDist = pNextPoint.X - pQueryPoint.X; // measure the distance between points PxTol apart
ITopologicalOperator pTopOp = (ITopologicalOperator)pQueryPoint;
IGeometry pSrchGeom = pTopOp.Buffer(pSrchDist);

If your feature class has a spatial reference other than the FocusMap you will need to project the points first before creating the buffer. Then setup a spatial filter:

ISpatialFilter pSF = new SpatialFilterClass();
pSF.Geometry = pSrchGeom;
pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

Now search from the ILayer as IFeatureLayer to return a cursor:

IFeatureCursor pDestCur = (YourLayer as IFeatureLayer).FeatureClass.Search(pSF, true); 
// recycling cursor, use non-recycling if you're going to modify any part of the feature

which you can iterate through:

IFeature pFeat = pDestCur.NextFeature();

    // do something with pFeat
    pFeat = pDestCur.NextFeature();
} while (pFeat != null);

Or you can select to get an ISelectionSet:

ISelectionSet pSelSet = (YourLayer as IFeatureLayer).FeatureClass.Select(
  • I could select point feature.. thank you very much..
    – riki
    Apr 24, 2018 at 4:19

You didn't post much code but I'm going to assume that identifyPoint is an IPoint in map coordinates.

IGeometry buffer = (identifyPoint as ITopologicalOperator).Buffer(1);
map.SelectByShape(buffer, null, true);

First you buffer the point you are using to search. The buffer will be in the units of the current geometry. So if I'm in UTM, the buffer would buffer 1 meter out. (doc)

Now I can take my current map and use select by shape. This will select anything within the buffer that is currently on the map. (doc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.