Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

ArcEngine 10 .Net 4 c#

Hi I'm currently allowing user to select a point on a polyline and creating a point on the line. I am using snapping tool.

I just want to make sure that when the user clicks on the screen, the point feedback that I get lies on top of the polyline.

I was wondering if there is a method that I can check if the IPOINT is ON any of the polylines in the polyline layer.

Thanks and Regards

share|improve this question
Sadly I think you mean .NET 3.5. 4.0 is not supported with ArcEngine – patrick Jun 14 '11 at 15:46
Do you mean on the polyline or on the symbology used to draw the polyline? – Kirk Kuykendall Jun 14 '11 at 18:21
up vote 4 down vote accepted

There's probably an easier way to do it but this is what I do.

//layer is what layer you are checking
ESRI.ArcGIS.Carto.IIdentify identify1 = layer as IIdentify; 

//idGeo is IGeometry you want to query -in your case a point, but I'm using a square here    
IArray array = identify1.Identify(idGeo);  

if (array != null)
    object obj = array.get_Element(0);
    IFeatureIdentifyObj fobj = obj as IFeatureIdentifyObj;
    IRowIdentifyObject irow = fobj as IRowIdentifyObject;
    IFeature feature = irow.Row as IFeature;
    IGeometry geometry1 = feature.Shape;
    IPointCollection pc = geometry1 as IPointCollection;
    if(pc != null && pc.PointCount > 0) //then its a polyline
share|improve this answer

You could probably use the iHitTest interface for this.

I only use VB so I don't have an example handy. Here is a version 9.3 example:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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