In general, you have to let FME know what attributes are being added
onto features as they exit each output on the transformer. There are a
couple ways this can be done:
[...trim...]
Thanks - I'll have a look at these.
You are right when you say that some of the transformers are "special".
Workbench has some special code that allows the AttributePrefixer (and
others) to do their magic and add these attributes dynamically. It is
difficult to say how you can get the output attributes you want without
knowing what your specific problem is. Could you email the transformer
definition and a description of what you're trying to achieve to our
support team?
Well, I kind of did, earlier this year, although I was less sure about how to do what I wanted at that stage ("sure?" I hear you ask)...
The response was along the lines (completely correctly) of "nope, you can't do that"
As an aside, while we don't prevent anyone from writing .fmx files by
hand, we don't really encourage it. Since FME 2006 you can make custom
transformers entirely using the Workbench interface, building from
existing transformers, and they become usable like any other
transformer. You can make one by selecting File -> New -> Create a
custom transformer. This may be an easier way to build your tool then
trying to write a .fmx file by hand. If you can't use this to build
your tool, let us know what you're trying to do and we'll see what we
can do to make it happen.
True, but works on the assumption that what you're trying to achieve is possible!
So, since you ask, here's what I was trying to do...
AIM: load shapefiles into PostGIS for use in MapServer
PROBLEM: MapServer currently cannot deal with upper case table names. Shapefiles should always have upper case names
OUTCOME: none of the tables loaded with FME work in MapServer
I believe older versions of FME automagically forced all table names to become lower case, but this has since been removed. Essentially, that is exactly what I want to do.
My solution (which works in theory): hybridise the AttributePrefixer and CaseChanger transformers to create AttributeCaseChanger (do you see what I did there?) It takes the attribute names and changes the case, as you might expect.
The problem then is that I can't persuade it to show the lower case attribute names, so I can't route them into the output, so I can't use them in MapServer (so I end up using different software to import them). It doesn't help matters that renaming tables in PostGIS is so blooming complicated.
It strikes me that this sort of thing might be useful functionality generally in FME (i.e. you can prefix your attribute names; change their cases; reverse them; translate them into Sanskrit; etc), but the support guy I emailed earlier in the year clearly wasn't so sure.
Some code (to prove what a clever boy I am)...
TRANSFORMER_NAME: AttributeCaseChanger
VERSION: 0
CATEGORY: Manipulators
INPUT_TAGS: <BLANK>
OUTPUT_TAGS: OUTPUT
PRESERVES_ATTRIBUTES: yes
ATTRIBUTES_ADDED:
PARAMETER_NAME: CHANGE_TYPE
PARAMETER_TYPE: CHOICE UPPERCASE%lowercase%Title
PARAMETER_PROMPT: Case Change:
PARAMETER_DEFAULT: lowercase
PARAMETER_LOOKUP: CHANGE_TYPE_TCL toupper%tolower%totitle
TEMPLATE_START
TCL proc $(XFORMER_NAME)_cc {} {
global FME_Attributes;
foreach attr [array names FME_Attributes] {
if {![regexp "^fme_" $attr]} {
set newAttr [string $(CHANGE_TYPE_TCL) $attr];
set FME_Attributes($newAttr) $FME_Attributes($attr);
unset FME_Attributes($attr);
};
};
}
FACTORY_DEF * TeeFactory
FACTORY_NAME $(XFORMER_NAME)
$(INPUT_LINES)
OUTPUT FEATURE_TYPE $(OUTPUT_OUTPUT_FTYPE)
@TCL("$(XFORMER_NAME)_cc")
$(OUTPUT_OUTPUT_FUNCS)
TEMPLATE_END
You might recognise some of that - I can't claim to have written any of it myself.
Thanks again for your help guys,
Roland.
__._,_.___
Join us at the FME Worldwide User Conference Sept. 21-22, 2006 Vancouver BC Canada. For more information, visit www.safe.com/2006uc.
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
