Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Setup:
I have some input data (SHAPE) which I use a Clipper transformer on. Depending on the result of the Clipper, I assign a value to an attribute. In the end I assign the two results/streams to a SHAPE writer.

Problem:
When I run the project my resulting SHAPE file has no attributes.

Observations:

  • If I open my output (by clicking on the arrow/triangle next to the OUTPUT) on the transformers before my writer, the attributes are available and the same for both the streams.
  • If I select Fanout By Attribute in Properties in my writer, all my attributes are available. If I select the User Attributes tab, no attributes are listed.

Through these observations, my attributes seems valid (supported by the transformers and the Fanout) and unique thus I see no reason why the writer shouldn't export them.

Solution:
Like GIS-Jonathan suggest, I have added my writer and selected the static schema. Then I right click my writer and select Copy Attributes From ... and select the desired source. Now I have all the attributes I want.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

This sounds like one of those annoying schema problems. When you placed the writer, did you place it as a "static schema" or a "dynamic schema"?

There are several possible problems but I suspect its the first one:

Static Schema

Do you have the attributes listed under your writer like this? enter image description here

If not you'll need to add them on the User Attributes tab (The + button) that you reference in your question. They should also have a little green arrow next to each attribute like I have here (the light grey line isn't necessary if they have the same name).

Dynamic Schema

This is where you have multiple different schemas (different sets of attributes) all going to the same writer. Some explanation of them here: http://fmepedia.safe.com/articles/Samples_and_Demos/Dynamic-Schema-Examples-FME2011 and: http://evangelism.safe.com/fmeevangelist54/

share|improve this answer
    
I used the static schema and I don't have the attributes listed under my writer. I normally add the attributes myself, but since (from my point of view) it is straight forward which attributes the writer should make available to me, I want it to do so - and not let me do something that is already done automatically by the translators. An inspector knows how to fetch the attributes. –  Chau Apr 20 '12 at 10:43
1  
In that case you'll need to set it to a Dynamic Schema. With a static Schema you have to specify the output attributes or you simply won't get any; this can be done easily by right-clicking on the writer and selecting either Copy Attributes From Feature Type (i.e. a reader) or Copy Attributes From Transformer. –  GIS-Jonathan Apr 20 '12 at 10:51
    
Oh yes, I can't guarantee that a Dynamic Schema will pick up any attributes that are created during the translation - they just clone the input schema. So in that case I think you'll have to manually add the created attributes to the User Attributes tab. –  GIS-Jonathan Apr 20 '12 at 10:54
    
I get what you are proposing, but I don't understand why its necessary :) I guess it has something to do with database stuff. I have used your Copy Attributes From Transformer approach and it seem to work just like a charm! Thanks a lot :) –  Chau Apr 20 '12 at 11:01
    
Why it's necessary I leave for @MarkIreland to explain (he works for Safe). I'd guess its to give you more control, especially over the data type (is it a varchar 20 or int? etc - FME is poor at figuring that stuff out itself as you'll see from the "copy from transformer"). –  GIS-Jonathan Apr 20 '12 at 11:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.