Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The problem I'm trying to solve is to find a point on a line given another point on the same line and a distance from the same point. I've been looking on the various RouteTask examples but they mostly tackle the problem of finding a route given two points. Can anyone advise if RouteTask is the right approach for this kind of problem, and how do I do it?

Thanks!

share|improve this question

1 Answer 1

You can find the second point given a line, starting point, and distance using the GeometryService. The method you use depends on whether you want absolute distance from the starting point (as the crow flies), or traveling distance.

Absolute Distance (as the crow flies)

  1. Create a Buffer around the starting point that's the distance you want.
  2. Convert the edge of the buffer polygon into a polyline
  3. Intersect the line in question with the buffer edge polyline to get the end point

Travelling Distance

  1. Break up a line by its vertices into individual line segments.
  2. Use a Lengths calculator to find the length of each line segment
  3. Starting from the beginning, deduct the length of each line segment from the length you want, until there's more length in a segment than in the remaining total.
  4. Break the last segment into by the fractional distance remaining to make the entire line the length you require.
  5. Find the point on the end of that line. That's your destination.

Here's a link to a jsFiddle I put together for the travelling distance calculator. you draw a line, and it cuts it off at the 5 mile mark. See it here.

share|improve this answer
    
Thank you, ray. Very helpful approaches. –  NeoJigglypuff Nov 21 '13 at 12:06

Your Answer

 
discard

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.