Skip to main content
Solved

Create Line from Point and Point Heading

  • April 27, 2017
  • 8 replies
  • 215 views

I have a collection of points and for each point a heading is recorded. What I want to do is create lines for a specified distance (say 20 meters) in the direction of the heading recorded for each point. The start point will be the X/Y of the point.

Does anyone have any ideas on how to get started with this?

Best answer by ebygomm

You'll need to do a bit of work to the heading to use the rotator

For example

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

8 replies

takashi
Celebrity
  • 7843 replies
  • April 27, 2017
How is the direction specified?

 

 


jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • April 27, 2017

I've done similar things in the past with a bit of trigonometry.

 

Basically add a VertexCreator in add point mode with the X value being the X0 + Distance*cos(Angle)

 

and the Y value being Y0 + Distance*sin(Angle).

 

 

where the Angle is in radians and measured counterclockwise from the positive x axis. (East)

 

 

if your heading is measured clockwise from the positive y axis (North) ie azimuth, you will need to convert using the formula

angle =mod(450?azimuth, 360) and then convert degrees to radians.


jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • April 27, 2017

I've done similar things in the past with a bit of trigonometry.

 

Basically add a VertexCreator in add point mode with the X value being the X0 + Distance*cos(Angle)

 

and the Y value being Y0 + Distance*sin(Angle).

 

 

where the Angle is in radians and measured counterclockwise from the positive x axis. (East)

 

 

if your heading is measured clockwise from the positive y axis (North) ie azimuth, you will need to convert using the formula

angle =mod(450?azimuth, 360) and then convert degrees to radians.

Note that this works best in a cartesian coordinate system. If you are working in lat/long over large distances, the math becomes more complicated and involves the law of haversine.

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • April 27, 2017

I would create the line using the vertex creator to add 20m to the y coordinate and then rotate (presuming your heading is set in degrees) using the original x y as the origin


  • Author
  • 7 replies
  • April 27, 2017
How is the direction specified?

 

 

The direction is specified as azimuth(from -180 to 180)

 

 


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • April 27, 2017

You'll need to do a bit of work to the heading to use the rotator

For example


takashi
Celebrity
  • 7843 replies
  • April 27, 2017
If the direction is specified by an angle (azimuth), the excellent solutions provided by @jdh and @egomm can be applied. I would try @egomm's approach with this workflow.

 


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • October 21, 2020

A different approach: 

You can also accomplish this using only a GeometryReplacer, with some trigonometry thrown in to build a WKT string (Well Known Text).

Point_to_Line_Geometry_ReplacerThe Geometry Source field contains this formula:

LINESTRING (@XValue() @YValue(), @Evaluate(@XValue() + (@Value(Distance) * sin(@degToRad(@Value(Azimuth))))) @Evaluate(@YValue() + (@Value(Distance) * cos(@degToRad(@Value(Azimuth))))))