Solved

Make line based on distance from single point, and change direction

  • 11 July 2018
  • 8 replies
  • 80 views

Badge +1

Hi. I want to make a line from a single point (based on distance in meter), and then change the direction.

 

I want to do this for multiple point. I have the line length, x and y coordinates, and line direction.

 

Line have to start from x and y point.

 

I'm using FME 2015.

 

 

Thanks.

icon

Best answer by takashi 12 July 2018, 11:59

View original

8 replies

Badge +2

Hi @johsflesj

I'm not sure what the best way to do this would be but I think you may have to go about this in a slightly different way - instead of creating a line and changing the direction I think the best option would be to create the end point first. You can do this by extracting the point coordinates and then using the arithmetic editor, create a second point by adding a distance value to x and y (-/+ will put this point in the right direction) and from there you can join the two together to build your lines.

What is your line direction attribute recorded in? If you know the line length and direction I think it should be possible to work out what values you need to change your original point from.

Badge +2

Hi @johsflesj

I'm not sure what the best way to do this would be but I think you may have to go about this in a slightly different way - instead of creating a line and changing the direction I think the best option would be to create the end point first. You can do this by extracting the point coordinates and then using the arithmetic editor, create a second point by adding a distance value to x and y (-/+ will put this point in the right direction) and from there you can join the two together to build your lines.

What is your line direction attribute recorded in? If you know the line length and direction I think it should be possible to work out what values you need to change your original point from.

In fact using the VertexCreator a line will automatically be created for you if you use the arithmetic editor and input x/y +/- these new distances. So the only hurdle here is calculating the values to add to x and y - finally school maths might actually come in handy!

 

 

Badge +22

Attached in an old custom transformer, since the last save version is 2014, it should be okay on 2015.

 

 

pointfrombearing.fmx

 

 

Note that this only really works in Cartesian coordinates. If you are in lat/long and covering large distances, you need to use a more complicated equation.
Badge +1

Hi @johsflesj

I'm not sure what the best way to do this would be but I think you may have to go about this in a slightly different way - instead of creating a line and changing the direction I think the best option would be to create the end point first. You can do this by extracting the point coordinates and then using the arithmetic editor, create a second point by adding a distance value to x and y (-/+ will put this point in the right direction) and from there you can join the two together to build your lines.

What is your line direction attribute recorded in? If you know the line length and direction I think it should be possible to work out what values you need to change your original point from.

Thanks for answering. The direction is recorded in degrees.

 

 

Userlevel 2
Badge +17

Assuming that each feature has four attributes - (x, y) of the first point, length of the line, and angle representing the line direction. An easy way is:

  1. VertexCreator (Mode: Replace with Point): Create a point (x, y).
  2. VertexCreator (Mode: Add Point): Add a point (x + length, y) to the first point to form a horizontal line with specified length.
  3. Rotator: Rotate the line around the first point (x, y) by specified direction (angle in degrees).
Badge +1

Assuming that each feature has four attributes - (x, y) of the first point, length of the line, and angle representing the line direction. An easy way is:

  1. VertexCreator (Mode: Replace with Point): Create a point (x, y).
  2. VertexCreator (Mode: Add Point): Add a point (x + length, y) to the first point to form a horizontal line with specified length.
  3. Rotator: Rotate the line around the first point (x, y) by specified direction (angle in degrees).
This way worked perfectly. Thank you so much!

 

Here is what i did:

 

 

Badge +1

Assuming that each feature has four attributes - (x, y) of the first point, length of the line, and angle representing the line direction. An easy way is:

  1. VertexCreator (Mode: Replace with Point): Create a point (x, y).
  2. VertexCreator (Mode: Add Point): Add a point (x + length, y) to the first point to form a horizontal line with specified length.
  3. Rotator: Rotate the line around the first point (x, y) by specified direction (angle in degrees).
Can some please explain me why VertexCreator (Add point) creates a line?
Badge +1

So, I made the data doing this:

 

The problem now is that only a few lines got the right direction. Most are pointing eastwards, when the direction deegree is for example 10 or 359.

 

 

Does anyone know?

Reply