span8
span4
span8
span4
So I have a point shapefile of orthophoto locations with approx. 250 features in it with attributes. I also have a .txt file to use as a template. What I basically need to do is for each feature in the shapefile, I need to extract the attributes, do a find/replace in the template, and write out to a text file. Essentially it's just creating text files with metadata of each orthophoto in it, so I should end up with approximately 250 text files when finished.
I'm not sure how to get FME to go through one feature at a time and write out to a .txt. Does anybody have any idea how to do this?
Hi@flip
with that many features (each becomes an output text file) you might struggle with the CSV Writernumber of open fileslimitation. Each file the Writer opens for writing is closed only at the end of translation. If you face this limitation, you can create a child workspace and run it from your main workspace using WorkspaceRunner. The child workspace will need to get the source features one by one (i.e. one per translation) and write the output text file for the received feature (which means only one destination text file will be open per translation).
To be more dynamic you can read the template textfile with Read whole file at once set to yes. That will give you one feature with the contents of the textfile stored as an attribute text_line_data. Connect the reader to a FeatureReader pointing to the shapefile with merge attributes set to yes.
You will now end up with all the features in your shapefile containing the template text, which you can manipulate as desired and then send to a text file writer with a dataset fanout.
Hi@flip ,
In order to use your template, you need to use the stringconcatenator transformer, click on switch to advanced. copy your template and paste it in the string expression, then you just have to fill up the gaps with the FME Feature attributes from your workspace or any other Published parameters. once you have done that you just need to fanout out your data based on a certain attribute value.
请注意,when writing in a text file, the text_line_data is one single feature saved in the the text file. If you want to have several records in your text file, I would suggest that you save it as a csv perhaps, otherwise you will be overwriting the text_line_data and the result will be only the last feature.
I hope this helps.
Lyes.
blocking transformers and looping4 Answers
Loop failing to read for some reason3 Answers
FeatureMerger not exact match1 Answer
API multiple records with limit3 Answers
Subtract list values from eachother based on index.2 Answers
© 2019 Safe Software Inc |Legal