2

I want to query a point on a polyline, using a starting point on the polyline, and a distance from the starting point, using Arcobjects.

My inputs Point A, Polyline A, Distance from pointA. Output Point B.

What I tried

var distanceAlong=0.5;
var distanceFrom=0.0;
var pointB=new PointClass();
polyline.QueryPointAndDistance(esriSegmentExtension.NoExtention,PointA,true,pointB,distanceAlong,distancefrom,false)

This didnt work for me, PointB is turning out to be the same as PointA.

QueryPoint is not what I want either since I have a starting point which I need to query from.

How can I find PointB from PointA using a distance along the curve/line ?

enter image description here

3

The method you are using is incorrect, it is for finding the closest point on the line and it's distance, think of it as snapping to the line.

You are asking to find a point measured along a line. You want to be using the method QueryPoint.

  • Good to hear from you :). Actually I want a point measured along the line, but starting from the other point. – ZZZ May 31 '17 at 12:56
  • 1
    Your image implies that point A is at the start of the polyline... Anyway you could use the method QueryPointAndDistance() to "snap" point A to your polyline, this will return the distance from the from end. Then it's a simple matter of adding that value to the distance you want from point A then use QueryPoint() method. – Hornbydd May 31 '17 at 15:03
  • I have used IConstructPoint.ConstructAlong resources.arcgis.com/en/help/arcobjects-net/componenthelp/… in the past with good results casting IFeature.ShapeCopy as ICurve (Polyline implements ICurve). The parameters are the same so it seems six of one, half dozen of the other. You are right though, QueryPointAndDistance returns the distance along the line pointA is and pointB as snapped to the line so be sure to use different variables to pass to QueryPoint or it will still return the same point as A. – Michael Stimson Jun 9 '17 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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