@trialing Try the VertexCreator. You can use two in a row, one to Replace wit Point and the second to Add Point
As you mentioned starting with coordinates, you may also be interested in the GeometryReplacer.
Set the Geometry Encoding to OGC Well Known Text, and format the Geometry Source like a WKT Linestring using the coordinates of the start point and end point:
LINESTRING (@Value(X_Start) @Value(Y_Start), @Value(X_End) @Value(Y_End))
Do you really need the Line Start Point and Stop Point Attributes to be Point WKT strings? That is somewhat unnecessary in FME.
As per @Mark Stoakes's post, generally you pass the Start Point X, Y numeric values into VertexCreator #1 to initialise the Geometry as a Point (Set as: Replace with Point), and then transform this to a 2 point line by sending these Points to a VertexCreator #2 (Set as: Add Point) that will add a second point and transform these to Lines using the separate end coordinates numeric X,Y,{Z} values.
Coincidentally, it is also not necessary in PostGIS/ST_MakeLine(). Using VertexCreator like this is aligned to the more usual application of ST_MakeLine as Eg.
ST_MakeLine(ST_MakePoint(x_start, y_start), ST_MakePoint(x_end, y_end))
ie. No need to make the Points into WKT strings if already have the X, Y coordinates as numerics.
As you mentioned starting with coordinates, you may also be interested in the GeometryReplacer.
Set the Geometry Encoding to OGC Well Known Text, and format the Geometry Source like a WKT Linestring using the coordinates of the start point and end point:
LINESTRING (@Value(X_Start) @Value(Y_Start), @Value(X_End) @Value(Y_End))
This is perfect. I do have the non POINT coords. Thank you!
Do you really need the Line Start Point and Stop Point Attributes to be Point WKT strings? That is somewhat unnecessary in FME.
As per @Mark Stoakes's post, generally you pass the Start Point X, Y numeric values into VertexCreator #1 to initialise the Geometry as a Point (Set as: Replace with Point), and then transform this to a 2 point line by sending these Points to a VertexCreator #2 (Set as: Add Point) that will add a second point and transform these to Lines using the separate end coordinates numeric X,Y,{Z} values.
Coincidentally, it is also not necessary in PostGIS/ST_MakeLine(). Using VertexCreator like this is aligned to the more usual application of ST_MakeLine as Eg.
ST_MakeLine(ST_MakePoint(x_start, y_start), ST_MakePoint(x_end, y_end))
ie. No need to make the Points into WKT strings if already have the X, Y coordinates as numerics.
I did, previous to this process I had to extract coordinates from a polygon and convert to points so I could query nearest neighbour from a different dataset. I do still have access to the coordinate attribution so you are right, absolutely no need to create the line from points.
I am new to this and for some reason I am developing fairly complex solutions first when I should really go step by step but so far it is working well enough.
Thanks again
As you mentioned starting with coordinates, you may also be interested in the GeometryReplacer.
Set the Geometry Encoding to OGC Well Known Text, and format the Geometry Source like a WKT Linestring using the coordinates of the start point and end point:
LINESTRING (@Value(X_Start) @Value(Y_Start), @Value(X_End) @Value(Y_End))
Is it also possible to use this linestring with Z coordinates?
Do you really need the Line Start Point and Stop Point Attributes to be Point WKT strings? That is somewhat unnecessary in FME.
As per @Mark Stoakes's post, generally you pass the Start Point X, Y numeric values into VertexCreator #1 to initialise the Geometry as a Point (Set as: Replace with Point), and then transform this to a 2 point line by sending these Points to a VertexCreator #2 (Set as: Add Point) that will add a second point and transform these to Lines using the separate end coordinates numeric X,Y,{Z} values.
Coincidentally, it is also not necessary in PostGIS/ST_MakeLine(). Using VertexCreator like this is aligned to the more usual application of ST_MakeLine as Eg.
ST_MakeLine(ST_MakePoint(x_start, y_start), ST_MakePoint(x_end, y_end))
ie. No need to make the Points into WKT strings if already have the X, Y coordinates as numerics.
I want to generate vertical lines with the same X, Y only difference in Z. I tried the above workflow, however, with the second vertex creator it rejects. Is it necessary to add a line builder after the two vertex creators? Or am I forgetting something else?