Suggestions for an efficient way to determine the local bearing of an arbitrary location along a line.
Local bearing is the azimuth angle of a given point to the next vertex in the line.
Bonus points if it iterates easily.
Suggestions for an efficient way to determine the local bearing of an arbitrary location along a line.
Local bearing is the azimuth angle of a given point to the next vertex in the line.
Bonus points if it iterates easily.
Hi,
If I've understood correctly, you want to split the line into 2-vertex segments (Splitter set at 2 vertices) and then use this custom transformer to get the angle. If you wish to assign the result back to the first point in each line segment, use a CoordinateExtractor to extract vertex 0, followed by a VertexCreator replacing the line with a point.
r.
Hi,
Like this?
1. Use chopper on polyline.
2. extract start and end vertices, and name them accordingly. I used S_x,S_y\\
and E_x,E_y.
3. calculate angle.
4. vertexcereator replace mode for startpoints.
5. vertexcreator with following vlaues
x= @Value(S_x)+@Evaluate(@Value(OFFSET)*@cos((@Value(Hoek_)/180)*$(Pi)))
y= @Value(S_y)+@Evaluate(@Value(OFFSET)*@sin((@Value(Hoek_)/180)*$(Pi)))
Offset variable i created to give lenght to a "bearingpointer" (arrow/vector)
Set lenght to you desire.
Now u got your bearing.
(nb. if you use Azimuthcalculator you wont need to extracxt endcoordinates.)
Hi,
If I've understood correctly, you want to split the line into 2-vertex segments (Splitter set at 2 vertices) and then use this custom transformer to get the angle. If you wish to assign the result back to the first point in each line segment, use a CoordinateExtractor to extract vertex 0, followed by a VertexCreator replacing the line with a point.
r.
I don't want the bearing at every vertex, but rather at specific points along the line, which may or may not correspond to an existing vertex.
Hi,
Like this?
1. Use chopper on polyline.
2. extract start and end vertices, and name them accordingly. I used S_x,S_y\\
and E_x,E_y.
3. calculate angle.
4. vertexcereator replace mode for startpoints.
5. vertexcreator with following vlaues
x= @Value(S_x)+@Evaluate(@Value(OFFSET)*@cos((@Value(Hoek_)/180)*$(Pi)))
y= @Value(S_y)+@Evaluate(@Value(OFFSET)*@sin((@Value(Hoek_)/180)*$(Pi)))
Offset variable i created to give lenght to a "bearingpointer" (arrow/vector)
Set lenght to you desire.
Now u got your bearing.
(nb. if you use Azimuthcalculator you wont need to extracxt endcoordinates.)
This gives me some ideas for a starting place. Thanks.
I don't want the bearing at every vertex, but rather at specific points along the line, which may or may not correspond to an existing vertex.
Sorry, I missed that.
OK, start by splitting the line at the points - there are various transformers that do this, but the simplest is probably PointOnLineOverlayer. So:
I also meant Chopper rather than Splitter, but that's academic now...
Hi @gio Would you be able to share your fmw Workspace for this solution please?
Hi @gio , Would you be able to share your fmw Workspace for your solution please?
@johnm
Hi, sure.
It's still on my machine.
The arrow custom is more complex then the main though...linebearings.fmw
Have fun.
Hi @gio, Thanks for this, I would like you to have a look at the one I did to see what you think?
Will get back to you tomorrow with the fmw.
Hi @gio, Thanks for this, I would like you to have a look at the one I did to see what you think?
Will get back to you tomorrow with the fmw.
Hi @gio, Here is another script (2016) for the arrow where the direction angle is provided. Cheers.
Hi @gio, Here is another script (2016) for the arrow where the direction angle is provided. Cheers.
Tx.
My arrow creator is scaled by input (larger line => larger arrows. Also size of arrowhead, shaft etc. are variable.)
It takes input lines, points or just attributes.
I have tried to make it as flexible as possible. It has evolved a bit since I posted above script. Trying to get it to make all kinds of arrowheads.
The createarrow.fmw is fixed size and has hardcoded values.