Just took a screenshot of the column.
So one possible way
Use an attribute splitter splitting at the ; to get a list of coordinates, explode this list so you have a feature per coordinate, a second attribute splitter splitting at , to split x,y and z coordinates. Use a vertex creator to create the points from these list items, then a line builder to join into lines
So one possible way
Use an attribute splitter splitting at the ; to get a list of coordinates, explode this list so you have a feature per coordinate, a second attribute splitter splitting at , to split x,y and z coordinates. Use a vertex creator to create the points from these list items, then a line builder to join into lines
Do I use AttributeExploder after AttributeSplitter? Splitter, Exploder, Splitter, VertexCreator? Won't this only give you two coordinates for each line?
Awesome! Thank you so much!
Do I use AttributeExploder after AttributeSplitter? Splitter, Exploder, Splitter, VertexCreator? Won't this only give you two coordinates for each line?
The AttributeSplitter (splitting on ";") will create an FME List of coordinates. Like:
- Feature 1:
- List Item 1: x,y
- List Item 2: x,y
- List Item 3: x,y
- Feature 2:
- List Item 1: x,y
- List Item 2: x,y
- Feature 3:
Then the ListExploder (not AttributeExploder) will give you a feature per coordinate pair.
- Feature 1: x,y
- Feature 2: x,y
- Feature 3: x,y
- Feature 4: x,y
- Feature 5: x,y
- Feature 6: x,y
- etc
The next AttributeSplitter extracts the x from the y and the VertexCreator now converts those to point features.
The LineBuilder at the end joins the points together where they belong to the same original feature.
So, yes, AttributeSplitter, ListExploder, AttributeSplitter, VertexCreator, LineBuilder.
Another solution would be to encode the coordinates inside a standard micro-format that FME can convert with the GeometryReplacer.
For example, with your data as:
5,5;12,5;15,7
Use a StringConcatenator to add
LINESTRING(
to the front of the coordinate list and add
)
to the end.
Now use a StringReplacer to replace , with a <space> character and ; with , which will give:
LINESTRING (5 5,12 5,15 7)
FME can now create the geometry automatically from that string with the GeometryReplacer transformer, where Geometry Encoding = WKT Well Known Text
Another solution would be to encode the coordinates inside a standard micro-format that FME can convert with the GeometryReplacer.
For example, with your data as:
5,5;12,5;15,7
Use a StringConcatenator to add
LINESTRING(
to the front of the coordinate list and add
)
to the end.
Now use a StringReplacer to replace , with a <space> character and ; with , which will give:
LINESTRING (5 5,12 5,15 7)
FME can now create the geometry automatically from that string with the GeometryReplacer transformer, where Geometry Encoding = WKT Well Known Text
I think they're y,x,z which complicates matters
Sounds like a Safe Software interview question 😏