Skip to main content
Solved

How to extract attribute to file name?

  • February 12, 2016
  • 7 replies
  • 172 views

Forum|alt.badge.img

Hi!

I am fairly new to FME. I am trying to develop a tool which creates a bounding box around features in the database. I've managed to create the bounding box as well as all my features into a .CSV file. What I want to do is make the writer use the coordinates found by the bounding box when saving the file name for each file. I have tried using @Value(<attr name>) however this just tells me my schema isn't set. I have also tried using a fan out feature on the writer, doing this allows me to save the file with the coordinates, however this then just leaves me with a blank file whereas I need a table with all the features and their added bits with it. Any help or advice on where to look would be appreciated!

Best answer by mark2atsafe

Hi Phil (@phil_peters)

I've created an example workspace that I think does what you need. It's for FME 2016 and you can find it (as a template with data) here: https://www.dropbox.com/s/s7y4nyq7s2kia0j/CSVBoundsFilename.fmwt?dl=0

Hope this helps

Mark

 

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

redgeographics
Celebrity
Forum|alt.badge.img+49

If I read you correctly you want a CSV file per feature with the coordinates of the bounding box as the filename.

You can do this as follows:

  1. Use a BoundsExtractor your features box. This will store the min and max x and y coordinates in a set of attributes (_xmin, _ymin, _xmax and _ymax by default, you can change those names if you want to)
  2. Set up the CSV File name in the output feature type properties to be a concatenation of those attrbitues.

Keep in mind though that this will generate really unwieldy filenames.


Forum|alt.badge.img
  • Author
  • February 15, 2016

@redgeographics thanks for the reply, I apologise for the unclear question it was written on a very tired Friday morning! I want one file with all the features inside the bounding box in the file with the filename set as the X&Y; Max & Min values. I have tried using @Value(_xmin) etc. however when I run this it returns

"Features With No Schema defined

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

371

342240 1

==============================================================================

Total Features NOT Written 372"


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • Best Answer
  • February 16, 2016

Hi Phil (@phil_peters)

I've created an example workspace that I think does what you need. It's for FME 2016 and you can find it (as a template with data) here: https://www.dropbox.com/s/s7y4nyq7s2kia0j/CSVBoundsFilename.fmwt?dl=0

Hope this helps

Mark

 


Forum|alt.badge.img
  • Author
  • February 19, 2016
mark2atsafe wrote:

Hi Phil (@phil_peters)

I've created an example workspace that I think does what you need. It's for FME 2016 and you can find it (as a template with data) here: https://www.dropbox.com/s/s7y4nyq7s2kia0j/CSVBoundsFilename.fmwt?dl=0

Hope this helps

Mark

 

Hi Mark, thanks for this. I am however using FME 2014 so am unable to see most of the transformers.

Thanks though!


takashi
Influencer
  • February 19, 2016

I guess that you have set Dynamic properties to the writer feature type. If so, there could be a wrong setting in the options (e.g. schema definition name).

The user interface for dynamic properties setting has been changed drastically in FME 2015.1, I forgot the interface of FME 2014. If you post some screenshots illustrating your settings for the feature type properties and dynamic properties options, it might help us to find what is wrong.


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • February 19, 2016
phil_peters wrote:

Hi Mark, thanks for this. I am however using FME 2014 so am unable to see most of the transformers.

Thanks though!

OK, try this: https://www.dropbox.com/s/761ikonn97len9y/CSVBoundsFilename2014.fmwt?dl=0


Forum|alt.badge.img
  • Author
  • February 22, 2016
mark2atsafe wrote:

Brilliant thanks so much Mark, I now have this working after some tweeking getting it into my project!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings