Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlexArcPy/3eae60b789310fa5cc21959ab4dad16f to your computer and use it in GitHub Desktop.
Save AlexArcPy/3eae60b789310fa5cc21959ab4dad16f to your computer and use it in GitHub Desktop.
Call FME workbench from Python: FMEWorkspaceRunner
import sys
sys.path.append(r"C:\Program Files (x86)\FME\fmeobjects\python27")
import fmeobjects
#----------------------------------------------------------------------
def buffer_single_shapefile_diff_param_values():
"""
Processes the same shapefile specified in the FME workbench project
creating multiple output shapefiles with the distance appended to the
output file.
The source shapefile path and the output folder path are hardcoded in
the workbench; two parameters are published in the workbench - one
for the the output shapefile name and another one for the distance value.
"""
try:
wkspc_path = r"C:\GIS\fme\FMEWorkbenches\BufferForSameShapefile.fmw"
wkspc = fmeobjects.FMEWorkspaceRunner()
for dist in xrange(100,200,25):
wkspc.runWithParameters(wkspc_path,{"Output_buffered_name":"Buffered_{0}m".format(dist),
"OFFSET":"{0}".format(dist)})
except fmeobjects.FMEException, err:
print "FMEException: %s" % err
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment