Skip to main content
Solved

How to write all raster properties to excel file?

  • May 12, 2014
  • 5 replies
  • 112 views

makt
Contributor
Forum|alt.badge.img+1
I'm experimenting with incorporating Excel workflows into my FME workspaces and am stuck.

 

 

My workspace reads in a raster, then I get raster properties using RasterPropertiesExtractor, then I create a few more attributes with AttributeCreator, and finally I want to write to an Excel file with each attribute name in the first column and its value in the second column.

 

 

I tried many settings under "format parameters" in the excel writer, but with no luck. The main problems I am having is that 1) nothing seems to write to the excel cells no matter what settings I have under "format parameters", and 2) the image of the raster is inserted into the excel file, which I don't know how to stop.

 

 

I'm obviously missing a few things in my first attempt...

 

 

 

Best answer by takashi

1) The AttributeExploder transformer can be used to transform the feature into multiple features containing pair of attribute (property) name and value. And also maybe you will have to remove features which contain unnecessary attribute names (e.g. fme_***).

 

 

2) You can control width of each column by modifying "Width" in "User Formats" page of the writer feature type.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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.

5 replies

takashi
Celebrity
  • May 12, 2014
Hi,

 

 

1) You will have to configure "User Attributes" of the Excel writer feature type.

 

Right-click on the writer feature type to show the shotcut menu > select "Copy Attributes From Transformer" > select AttributeCreator.

 

Open Feature Type Properties dialog, go to User Attributes page, edit attribute Types etc.

 

Go to Format Parameters page, check "Output Field Names" is set as "Yes" (default).

 

 

2) Try using the GeometryRemover to remove the raster before writing.

 

 

Takashi

makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • May 12, 2014
Hi Takashi - excellent tips - it almost works as expected:

 

 

1) currently the names are inserted as columns and the values are inserted in the next row. How can I transpose this in FME so that each property name is a new row in the first column and the value be in the next column? Couldn't find any writer format parameters that would do this, do I need an additional transformer

 

2) possibly related to 1) - the output excel table has very very wide columns - is there a way to control this ?

takashi
Celebrity
  • Best Answer
  • May 13, 2014
1) The AttributeExploder transformer can be used to transform the feature into multiple features containing pair of attribute (property) name and value. And also maybe you will have to remove features which contain unnecessary attribute names (e.g. fme_***).

 

 

2) You can control width of each column by modifying "Width" in "User Formats" page of the writer feature type.

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 13, 2014
Use atributeexploder.

 

 

1stColumn = @Value(_attr_name)

 

2ndColumn = @Value(_attr_value)

 


makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • May 15, 2014
Got it working - thanks guys.

 

 

Gio- I tried using your formulas but it results in a red cog in the AttributeExploder (I'm not sure if that is where those formulas are meant to go?)