I saw a great interface to FME with Python there
What you guys are doing with it? I want ideas.
I'm just getting started with FME, and am using a shutdown script to copy my target FGDB to another location and to save out the log file:
That's pretty basic, but there really is no limit I don't think. There are tons of ideas here as well.
EDIT: Added in code to get numbers of features written and push those out to CSV log file.
Have a look at Oliver's Python Corner. There's a ton of things you can do using Python in FME.
I often use the PythonCaller to make some attributemanipulations inside 1 transformer rather than using 10 different transformers (if elif elif else ..)
You can have very basic PythonCallers like this example which will convert all your attributes to uppercase values:
I also use the PythonCaller to send emails in case of failure or interact with an FTP Server etc .. There are really no limits
Have fun and happy FMEing
import os.path, time, os, datetime, main , sys, pyfme,shutil from pyfme import *
class expFeature(object): def init(self): self.logger = pyfme.FMELogfile() pass
And Send Email:
Good example above: I'm currently writing an article for our knowledgebase called FMEPedia here: Python and FME Basics.
This includes some simple examples such as deleting a file before running a workspace with a start up script, manipulating features with a PythonCaller etc. There are also links to more complex examples.
Ken Bragg Safe Software
I've recently been using a PythonCaller transformer which gets coordinates from a CSV file and saves them as attributes. The CSV gets written from a another workspace which uses a BoundsExtractor Transformer which gets the bounding coordinates from a bounding box of my area of interest.
I then pass these attributes to other WorkspaceRunners which use the bounding coordinates as a search window for further processing. I have State-Wide data and to process on the whole state would take several hours. Because I limit my processing to a particular window, the whole thing takes one minute.
The pythonCaller code is here:
I also use a python start up script which copies a folder tree to another location if it doesn't exist already.