Hi all,
I have the greatest respect for folk who have mastered a skill I have great trouble with, and computer programming – or is it now software engineering? – is high on this list. If you know the difference between a class and an interface (and a method and an object) then kudos to you.

However, sometimes I think developers get the wrong end of the stick with regard to FME. So here’s a quick guide to FME for developers, with particular emphasis on something new for FME2011.

Getting Started
I’ve seen – and seen quite often – questions from folk who have installed FME for evaluation and immediately started coding a C++ solution to do something like convert Shape data to KML

Dude! Just because we have an SDK, doesn’t mean you have to use it for everything!

Seriously, when you set out to translate and transform spatial data programmatically, you might want to consider whether it’s an effective use of your time. Most users could accomplish a Shape to KML translation in under 30 seconds with Workbench. Do you really need to spend days doing the same thing in Java?

Plus, you can run a workspace on FME Server – but you can’t do the same with an FME Objects application.

What it comes down to is this: it’s more efficient and flexible to define a translation in Workbench, and just execute it programmatically, than it is to code the whole thing from scratch.

And where FME2011 comes in is that we have a whole new way to do just that. But first let’s review a couple of existing methods.

Command Line Execution
Because FME is a command line engine at heart, it’s very simple to execute a workspace by issuing a command in that form. The log window for any workspace will even tell you what that command should be. Even non-programmers (like myself) can manage to wrap that sort of functionality into a nicer interface for an end user to use.

FME Server Execution
When you need to execute a workspace from within a web page, then FME Server is the way to go. It’s simple to publish a workspace to the server and, because of the easy-to-use API, it’s a doddle to kick off a translation using a URL. You can even do it RESTfully with FME Server 2011

The difficulty in running a workspace programmatically has been that there was no way to actually use FME Objects to run a workspace; or at least no simple and flexible way. So you would find it quite difficult to define a translation within Workbench and then run it from your own application.

What’s new for FME2011 is a class (or is that interface?) within FME Objects called IFMEWorkspaceRunner, that does as the name suggests and provides a way to run a workspace from an application.

Check out the API docs at <FME>fmeobjectscppapidocclassIFMEWorkspaceRunner.html (you must choose to install the developer resources to get these).

This document tells me there are 8 public methods available with this class. Let’s see what they do:

IFMEWorkspaceRunner Methods

This is also important because promptRun accepts parameters and passes them straight to FME. There is no feedback on what those values were. Using runWithParameters this way lets you keep a record of what parameters were set.

Of course, you can’t pass parameter values to a workspace unless you know exactly what parameters are required, and in what form. So there are a series of methods to fetch that information:

For an example of the IFMEWorkspaceRunner, check out the samples in the FME Objects folder (eg C:/apps/FME/fmeobjects/cpp/apidoc/classIFMEWorkspaceRunner.html) or our online doc.

IFMEWorkspaceRunner is available for use in C++, Java and .NET in FME2011 beta builds 6458 or greater. Hopefully there will also be a Python version by the time FME2011 is released.


Quick Review!
Q) Why is IFMEWorkspaceRunner important?
A) Developing translations is much easier in Workbench than it is using FME Objects in a programming environment. IFMEWorkspaceRunner is important because it lets you develop a translation in the easier environment (Workbench) and run it within a software application.

And don’t forget…
There are a series of upcoming FME User Meetings in October 2010. Don Murray (our President), Mark Stoakes (head of Professional Services) and Craig Vernon (Director of Sales) will be visiting Regina (SK), Edmonton (AB), Denver (CO), Seattle (WA) and Victoria (BC) for a series of presentations and all sort of other fun.

You can check out the agendas and sign up using the link above.


.NET About FME API C++ Developer Tools FME Desktop FME Objects IFMEWorkspaceRunner Java Miscellaneous REST

Mark Ireland

Mark, aka iMark, is the FME Evangelist (est. 2004) and has a passion for FME Training. He likes being able to help people understand and use technology in new and interesting ways. One of his other passions is football (aka. Soccer). He likes both technology and soccer so much that he wrote an article about the two together! Who would’ve thought? (Answer: iMark)


Comments are closed.

Related Posts