Hi,
Welcome to the wonderful world of FME!
To force something into 3D based on an attribute see the 3DForcer transformer, just type 3D in the canvas and select the correct transformer.
Where do you need to export these lines to? which target format?
To test if a feature is 2D or 3D I would extract the coordinates of the first vertex (CoordinateExtractor using index = 0) with a default value for Z being -9999. These are the default settings for the transformer.
Next you can test (Tester) for all features having Z=-9999.
Then as @itay said use the 3DForcer on the features having Z=-9999 to set the Z value from the selected attribute.
To test if a feature is 2D or 3D I would extract the coordinates of the first vertex (CoordinateExtractor using index = 0) with a default value for Z being -9999. These are the default settings for the transformer.
Next you can test (Tester) for all features having Z=-9999.
Then as @itay said use the 3DForcer on the features having Z=-9999 to set the Z value from the selected attribute.
well these 2D lines has actually Z=0
And it might be also polylines not just lines.
I was thinking something like adding all Z values from each vertex on the line, in modules, and if the sum is 0 then it is a 2D line. but again i don't know how to do that.
Also about the 3DForcer what is the rejected feature? is the features that the attribute has null value?
well these 2D lines has actually Z=0
And it might be also polylines not just lines.
I was thinking something like adding all Z values from each vertex on the line, in modules, and if the sum is 0 then it is a 2D line. but again i don't know how to do that.
Also about the 3DForcer what is the rejected feature? is the features that the attribute has null value?
The rejected feature is a feature that can not be converted into a 3D geometry (usually a non-spatial geometry).
Getting all Z values can be done using the CoordinateConcatenator (selecting only the Z). This will get you a comma separated list. You can convert that into an array using the AttributeSplitter and the get the sum using the ListSummer.
It sounds like you just want to filter the features depending on whether they are 2D or 3D.
2D lines have a Z value of zero (0) but equally a 3D line could include a zero Z value at some point.
So, to use the methodology you suggested, try this:
- A CoordinateConcatenator, to concatenate only Z values into a comma delimited string
- An AttributeSplitter to split that attribute string into an FME "list"
- A ListRangeExtractor to find the maximum value for that list
- A Tester to test if Max > 0
If Max > 0 then it is 3D. If Max=0 then it is 2D.
Attached is a 2dvs3dlines.fmwt. Hope this helps, and welcome to both FME and the FME Q+A forum!
Mark
ps - I'm just writing a Data QA tutorial for FME and this is a great example to include, so thanks for giving me the idea!
pps - I just noticed @erik_jan gave the same method in the time it was taking me to write this. Well, they do say that great minds think alike!
It sounds like you just want to filter the features depending on whether they are 2D or 3D.
2D lines have a Z value of zero (0) but equally a 3D line could include a zero Z value at some point.
So, to use the methodology you suggested, try this:
- A CoordinateConcatenator, to concatenate only Z values into a comma delimited string
- An AttributeSplitter to split that attribute string into an FME "list"
- A ListRangeExtractor to find the maximum value for that list
- A Tester to test if Max > 0
If Max > 0 then it is 3D. If Max=0 then it is 2D.
Attached is a 2dvs3dlines.fmwt. Hope this helps, and welcome to both FME and the FME Q+A forum!
Mark
ps - I'm just writing a Data QA tutorial for FME and this is a great example to include, so thanks for giving me the idea!
pps - I just noticed @erik_jan gave the same method in the time it was taking me to write this. Well, they do say that great minds think alike!
thank you.
Now i can test both min and max value for 0. if both are 0 then i know its a 2D lines.
Its not enough to just sum them cause i might get some minus values on the line.But with ListRangeExtractor i can make sure the line is 2D.
of course you would want to test if max z < 0 too...seems 3D to me.
Apart from that neither test prove the objects are 2d or 3d.
2D geometry simply has no z component.
The tests you suggest simply assume that objects are 3D if they are above some 0-plane in not the x or y plane.
Focussing on any axis an object is 2D if it has no range in one of the planes.
of course you would want to test if max z < 0 too...seems 3D to me.
Apart from that neither test prove the objects are 2d or 3d.
2D geometry simply has no z component.
The tests you suggest simply assume that objects are 3D if they are above some 0-plane in not the x or y plane.
Focussing on any axis an object is 2D if it has no range in one of the planes.
true. but in my case all lines has Z values. So for me its exactly what i need. I have no other way to find these lines.