There was a time, not too long ago, when scripting GIS software required learning specialized languages that were not only vendor-specific, but also not used outside of the industry. This made scripts into islands that could not talk to other another vendor’s environment, and limited the pool of people working in the language to a small group of GIS professionals. Today, many vendors (as well as most open source GIS tools) have some form of Python support, which not only allows scripts to not talk to multiple vendors, but also to take advantage of thousands of free libraries written by Python programmers who don’t use GIS.
Perhaps the most flexible of FME’s 300+ transformers is the PythonCaller. While consisting of only 2 parameters (Python symbol and Python source), it opens up workspaces to talk to any python library, which can be very powerful. In the past, we required users to install Python on their systems independently of FME in order to use these transformers, however recently we began bundling a Python interpreter with FME, which has opened up the use of this transformer to even more users.
A common task for the PythonCaller is to push features from FME into another program, and then pull them back in. For example, if you need to geocode tabular data before processing it with FME, you can easily pass it to an ESRI python geoprocessing script, or any other python library for that matter. Python is also a great way to interact with webservices which FME cannot natively read or write from, such as Google Spreadsheets. We are aware of several cases where people have used Python to access ESRI’s Geoprocessing tools in workspaces to perform tasks specific to ESRI tools.
In addition to allowing you to use external Python libraries in FME, we also have our own Python library, pyfme, which exposes our FME Objects API in Python. With this, you can actually create your own transformers in Python, such as a geocoder.
There are some great resources out there on using Python in GIS applications. Oliver’s Python Corner is probably the best source for FME-specific Python information. Oliver’s tutorial and sample code is great way to get up and running with Python in your workspaces. Sean Gillies (maintainer of some wonderful open source GIS Python libraries) has a blog where he often posts useful Python snippets (his recent Python and GIS 101, while somewhat abstract, is a great introduction of using Python for GIS. Hopefully the “101” means this is the beginning of a series). ESRI has a large library of Python Geoprocessing scripts which can be plugged into FME with a little work. Lastly, Sean Gillies has started a Python GIS SIG Google Group, which has some great discussion of general GIS/Python issues.
With so many GIS platforms offering Python support, it has become very easy to create unified workflows which pull from several libraries. By having the industry largely standardized on a powerful, non domain-specific programming language with very wide usage outside the GIS community, we now have a larger community to both share our own work with, as well as borrow from to make our own scripts better.