Use the dynamic option on the writer.
Lead both the Generic data and the Schema from the FeatureReader to the output.
And tell the output feature type to take the schema from the Schema object:
Hello @erik_jan, thanks your help :)
I have a question: i would like extract the geometries and attributes after this transformer FeatureReader to work along my Workflow.
Thanks
Hello @erik_jan, thanks your help :)
I have a question: i would like extract the geometries and attributes after this transformer FeatureReader to work along my Workflow.
Thanks
In the FeatureReader you have the option to expose the attributes.
But that requires you to know what attributes are available and using a generic reader that usually is not the case.
For the geometry you can use the GeometryExtractor transformer.
Hi @danilo_inovacao
- I guess the question is, how can you work with the attributes if you
don't know what they are going to be? But if you do know what they will
be, then you can use the option to expose them!
The only way to
work with attributes when you don't know their name is to also read the
schema with the FeatureReader so you have the information about what is
available. Then you could merge that onto the main features and update
the attributes using something like:
@Value(attribute{x}.name) = abcd
Here is a workspace that does that. It changes the third attribute (here ParkName) to something different. But it's fairly restrictive over what it can do (eg it would always need to be the third attribute in the schema).
Hope this helps.
Hi @danilo_inovacao, as @erik_jan mentioned, the GeometryExtractor can be used to extract the geometry as an attribute value. Regarding attributes, you can use the AttributeExploder to "extract" pairs of attribute name and value as regular attributes or list elements. However, I don't know if it's your requirement.
What do you mean "extract the geometries and attributes" in the context? If you need to manipulate feature attributes with a regular transformer in the subsequent workflow, possibly you will have to expose their names manually with the AttributeExposer anyway.
Use the dynamic option on the writer.
Lead both the Generic data and the Schema from the FeatureReader to the output.
And tell the output feature type to take the schema from the Schema object:
If you intend to write each feature into a destination feature type with the same name as its source feature type, you should set "fme_feature_type" to the Shapefile Name field, rather than "fme_feature_type_name".
"fme_feature_type_name" is an attribute of the schema feature, and the data features usually don't have "fme_feature_type_name". If you set "fme_feature_type_name" to the Shapefile Name field, the writer cannot determine destination feature type for each feature, unless you have added "fme_feature_type_name" to every feature before writing.